Activity 9b: Get the total number of stores from bookstores
1. Understanding the Goal
从 bookstores 对象中读取 totalStores 属性,并在模板中显示门店总数。
2. Step-by-Step Instruction
- Step 1: Ensure the
bookstoresobject is imported and available in the component. - Step 2: Access the
totalStoresproperty viabookstores.totalStores. - Step 3: Render the value using Vue interpolation
{{ }}.
3. Code Explanation
| 部分 | 说明 |
|---|---|
bookstores | 已导入的 JSON 对象,包含公司相关信息。 |
bookstores.totalStores | 访问对象的 totalStores 数值,用于表示门店总数。 |
{{ ... }} | Vue 插值语法,在模板中渲染变量。 |
<strong>...</strong> | 样式标签,将数值加粗显示,便于突出重点。 |