浏览代码

docs(tabbar): edit doc (#1941)

Drjingfubo 3 年之前
父节点
当前提交
01f2cd67c4

+ 6 - 6
src/packages/__VUE/tabbar/doc.en-US.md

@@ -106,13 +106,13 @@ Use icon slot to custom icon.
 ```html
 <template>
   <nut-tabbar @tab-switch="tabSwitch">
-    <nut-tabbar-item tab-title="首页">
+    <nut-tabbar-item tab-title="tab">
       <template #icon="props">
           <img :src="props.active ? icon.active : icon.unactive" alt="" />
         </template>
     </nut-tabbar-item>
-    <nut-tabbar-item tab-title="分类" icon="category"></nut-tabbar-item>
-    <nut-tabbar-item tab-title="发现" icon="find"></nut-tabbar-item>
+    <nut-tabbar-item tab-title="tab" icon="category"></nut-tabbar-item>
+    <nut-tabbar-item tab-title="tab" icon="find"></nut-tabbar-item>
   </nut-tabbar>
 </template>
 <script>
@@ -216,11 +216,11 @@ Use icon slot to custom icon.
 
 | Attribute            | Description               | Type   | Default  |
 |-----------------|--------------------|--------|---------|
-| v-model:visible | The index value of the selected label  | number | 0       |
+| v-model:visible | Identifier of current tab | number | 0       |
 | bottom          | Whether to fix the bottom | boolean | false   |
 | size          | icon size | string | '20px'  |
-| unactive-color  | Color of unactive tab item  | string | #7d7e80 |
-| active-color    | Color of active tab item    | string | #1989fa |
+| unactive-color  | Color of unactive tab item  | string | #000 |
+| active-color    | Color of active tab item    | string | #fa2c19  |
 | safe-area-inset-bottom   | Whether to enable bottom safe area adaptation    | boolean | false |
 | placeholder `3.2.6` | Whether to generate a placeholder element when fixed | boolean | false |
 ### TabbarItem Props

+ 5 - 4
src/packages/__VUE/tabbar/doc.md

@@ -261,12 +261,13 @@ app.use(Icon);
 
 | 字段            | 说明               | 类型   | 默认值  |
 |-----------------|--------------------|--------|---------|
-| v-model:visible | 选中标签的索引值   | number | 0       |
+| v-model:visible | 当前选中标签的名称或索引值   | number|string | 0       |
 | bottom          | 是否固定在页面底部 | boolean | false   |
 | size          | icon的尺寸/图片的宽高 | string | '20px'  |
-| unactive-color  | icon未激活的颜色   | string | #7d7e80 |
-| active-color    | icon激活的颜色     | string | #1989fa |
+| unactive-color  | icon未激活的颜色   | string | #000  |
+| active-color    | icon激活的颜色     | string | #fa2c19 |
 | safe-area-inset-bottom   | 是否开启iphone系列全面屏底部安全区适配    | boolean | false |
+| placeholder `3.2.6` | 固定在底部时,是否在标签位置生成一个等高的占位元素 | boolean | false |
 ### TabbarItem Props
 
 | 字段      | 说明                                      | 类型   | 默认值 |
@@ -282,7 +283,7 @@ app.use(Icon);
 | to  `小程序不支持`      | 	标签页的路由对象,等于 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) 属性 | string|object | --     |
 | num       | 页签右上角的数字角标,超出99之后为99+     | number | --     |
 | dot       | 是否显示图标右上角小红点   | boolean | false    |
-| placeholder `3.2.6` | 固定在底部时,是否在标签位置生成一个等高的占位元素 | boolean | false |
+
 
 
 ### TabbarItem Slots

+ 3 - 3
src/packages/__VUE/tabbaritem/index.taro.vue

@@ -115,11 +115,11 @@ export default create({
       active: parent.modelValue, // 是否选中
       index: 0
     });
-    const relation = (child: ComponentInternalInstance): void => {
+    const relation = (child: ComponentInternalInstance) => {
       if (child.proxy) {
         parent.children.push(child.proxy);
-        const index = computed(() => parent.children.indexOf(child.proxy));
-        state.index = props.name ?? index.value;
+        const index = parent.children.indexOf(child.proxy);
+        state.index = props.name ?? index;
       }
     };
     relation(getCurrentInstance() as ComponentInternalInstance);

+ 3 - 3
src/packages/__VUE/tabbaritem/index.vue

@@ -118,11 +118,11 @@ export default create({
       index: 0
     });
     const router = useRouter();
-    const relation = (child: ComponentInternalInstance): void => {
+    const relation = (child: ComponentInternalInstance) => {
       if (child.proxy) {
         parent.children.push(child.proxy);
-        const index = computed(() => parent.children.indexOf(child.proxy));
-        state.index = props.name ?? index.value;
+        const index = parent.children.indexOf(child.proxy);
+        state.index = props.name ?? index;
       }
     };
     relation(getCurrentInstance() as ComponentInternalInstance);