mirror of
https://github.com/youzan/vant.git
synced 2025-10-21 19:24:16 +00:00
docs: prettier all markdown files
This commit is contained in:
@@ -27,10 +27,10 @@ Vue.use(TabbarItem);
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
active: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
active: 0,
|
||||
};
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### Match by name
|
||||
@@ -48,10 +48,10 @@ export default {
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
active: 'home'
|
||||
}
|
||||
}
|
||||
}
|
||||
active: 'home',
|
||||
};
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### Show Badge
|
||||
@@ -73,9 +73,9 @@ Use `icon` slot to custom icon
|
||||
<van-tabbar v-model="active">
|
||||
<van-tabbar-item badge="3">
|
||||
<span>Custom</span>
|
||||
<template #icon="props">
|
||||
<img :src="props.active ? icon.active : icon.inactive"/>
|
||||
</template>
|
||||
<template #icon="props">
|
||||
<img :src="props.active ? icon.active : icon.inactive" />
|
||||
</template>
|
||||
</van-tabbar-item>
|
||||
<van-tabbar-item icon="search">Tab</van-tabbar-item>
|
||||
<van-tabbar-item icon="setting-o">Tab</van-tabbar-item>
|
||||
@@ -89,21 +89,17 @@ export default {
|
||||
active: 0,
|
||||
icon: {
|
||||
active: 'https://img.yzcdn.cn/vant/user-active.png',
|
||||
inactive: 'https://img.yzcdn.cn/vant/user-inactive.png'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
inactive: 'https://img.yzcdn.cn/vant/user-inactive.png',
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### Custom Color
|
||||
|
||||
```html
|
||||
<van-tabbar
|
||||
v-model="active"
|
||||
active-color="#07c160"
|
||||
inactive-color="#000"
|
||||
>
|
||||
<van-tabbar v-model="active" active-color="#07c160" inactive-color="#000">
|
||||
<van-tabbar-item icon="home-o">Tab</van-tabbar-item>
|
||||
<van-tabbar-item icon="search">Tab</van-tabbar-item>
|
||||
<van-tabbar-item icon="freinds-o">Tab</van-tabbar-item>
|
||||
@@ -111,7 +107,6 @@ export default {
|
||||
</van-tabbar>
|
||||
```
|
||||
|
||||
|
||||
### Change Event
|
||||
|
||||
```html
|
||||
@@ -130,9 +125,9 @@ export default {
|
||||
methods: {
|
||||
onChange(index) {
|
||||
Notify({ type: 'primary', message: index });
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### Route Mode
|
||||
@@ -155,38 +150,38 @@ export default {
|
||||
### Tabbar Props
|
||||
|
||||
| Attribute | Description | Type | Default |
|
||||
|------|------|------|------|
|
||||
| v-model | Identifier of current tab | *number \| string* | `0` |
|
||||
| fixed | Whether to fixed bottom | *boolean* | `true` |
|
||||
| border | Whether to show border | *boolean* | `true` |
|
||||
| z-index | Z-index | *number \| string* | `1` |
|
||||
| active-color | Color of active tab item | *string* | `#1989fa` |
|
||||
| inactive-color | Color of inactive tab item | *string* | `#7d7e80` |
|
||||
| route | Whether to enable route mode | *boolean* | `false` |
|
||||
| placeholder `v2.6.0` | Whether to generage a placeholder element when fixed | *boolean* | `false` |
|
||||
| safe-area-inset-bottom | Whether to enable bottom safe area adaptation | *boolean* | `false` |
|
||||
| --- | --- | --- | --- |
|
||||
| v-model | Identifier of current tab | _number \| string_ | `0` |
|
||||
| fixed | Whether to fixed bottom | _boolean_ | `true` |
|
||||
| border | Whether to show border | _boolean_ | `true` |
|
||||
| z-index | Z-index | _number \| string_ | `1` |
|
||||
| active-color | Color of active tab item | _string_ | `#1989fa` |
|
||||
| inactive-color | Color of inactive tab item | _string_ | `#7d7e80` |
|
||||
| route | Whether to enable route mode | _boolean_ | `false` |
|
||||
| placeholder `v2.6.0` | Whether to generage a placeholder element when fixed | _boolean_ | `false` |
|
||||
| safe-area-inset-bottom | Whether to enable bottom safe area adaptation | _boolean_ | `false` |
|
||||
|
||||
### Tabbar Events
|
||||
|
||||
| Event | Description | Arguments |
|
||||
|------|------|------|
|
||||
| Event | Description | Arguments |
|
||||
| ------ | -------------------------------- | ---------------------------- |
|
||||
| change | Triggered when change active tab | active: index of current tab |
|
||||
|
||||
### TabbarItem Props
|
||||
|
||||
| Attribute | Description | Type | Default |
|
||||
|------|------|------|------|
|
||||
| name | Identifier | *number \| string* | Item index |
|
||||
| icon | Icon name | *string* | - |
|
||||
| icon-prefix `v2.5.3` | Icon className prefix | *string* | `van-icon` |
|
||||
| dot | Whether to show red dot | *boolean* | - |
|
||||
| badge `v2.5.6` | Content of the badge | *number \| string* | `''` |
|
||||
| url | Link | *string* | - |
|
||||
| to | Target route of the link, same as to of vue-router | *string \| object* | - |
|
||||
| replace | If true, the navigation will not leave a history record | *boolean* | `false` |
|
||||
| --- | --- | --- | --- |
|
||||
| name | Identifier | _number \| string_ | Item index |
|
||||
| icon | Icon name | _string_ | - |
|
||||
| icon-prefix `v2.5.3` | Icon className prefix | _string_ | `van-icon` |
|
||||
| dot | Whether to show red dot | _boolean_ | - |
|
||||
| badge `v2.5.6` | Content of the badge | _number \| string_ | `''` |
|
||||
| url | Link | _string_ | - |
|
||||
| to | Target route of the link, same as to of vue-router | _string \| object_ | - |
|
||||
| replace | If true, the navigation will not leave a history record | _boolean_ | `false` |
|
||||
|
||||
### TabbarItem Slots
|
||||
|
||||
| Name | Description | SlotProps |
|
||||
|------|------|------|
|
||||
| icon | Custom icon | active |
|
||||
| ---- | ----------- | --------- |
|
||||
| icon | Custom icon | active |
|
||||
|
@@ -29,10 +29,10 @@ Vue.use(TabbarItem);
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
active: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
active: 0,
|
||||
};
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### 通过名称匹配
|
||||
@@ -52,10 +52,10 @@ export default {
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
active: 'home'
|
||||
}
|
||||
}
|
||||
}
|
||||
active: 'home',
|
||||
};
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### 徽标提示
|
||||
@@ -79,9 +79,9 @@ export default {
|
||||
<van-tabbar v-model="active">
|
||||
<van-tabbar-item badge="3">
|
||||
<span>自定义</span>
|
||||
<template #icon="props">
|
||||
<img :src="props.active ? icon.active : icon.inactive"/>
|
||||
</template>
|
||||
<template #icon="props">
|
||||
<img :src="props.active ? icon.active : icon.inactive" />
|
||||
</template>
|
||||
</van-tabbar-item>
|
||||
<van-tabbar-item icon="search">标签</van-tabbar-item>
|
||||
<van-tabbar-item icon="setting-o">标签</van-tabbar-item>
|
||||
@@ -95,21 +95,17 @@ export default {
|
||||
active: 0,
|
||||
icon: {
|
||||
active: 'https://img.yzcdn.cn/vant/user-active.png',
|
||||
inactive: 'https://img.yzcdn.cn/vant/user-inactive.png'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
inactive: 'https://img.yzcdn.cn/vant/user-inactive.png',
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### 自定义颜色
|
||||
|
||||
```html
|
||||
<van-tabbar
|
||||
v-model="active"
|
||||
active-color="#07c160"
|
||||
inactive-color="#000"
|
||||
>
|
||||
<van-tabbar v-model="active" active-color="#07c160" inactive-color="#000">
|
||||
<van-tabbar-item icon="home-o">标签</van-tabbar-item>
|
||||
<van-tabbar-item icon="search">标签</van-tabbar-item>
|
||||
<van-tabbar-item icon="freinds-o">标签</van-tabbar-item>
|
||||
@@ -135,9 +131,9 @@ export default {
|
||||
methods: {
|
||||
onChange(index) {
|
||||
Notify({ type: 'primary', message: index });
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### 路由模式
|
||||
@@ -162,39 +158,39 @@ export default {
|
||||
### Tabbar Props
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|------|------|------|------|
|
||||
| v-model | 当前选中标签的名称或索引值 | *number \| string* | `0` |
|
||||
| fixed | 是否固定在底部 | *boolean* | `true` |
|
||||
| border | 是否显示外边框 | *boolean* | `true` |
|
||||
| z-index | 元素 z-index | *number \| string* | `1` |
|
||||
| active-color | 选中标签的颜色 | *string* | `#1989fa` |
|
||||
| inactive-color | 未选中标签的颜色 | *string* | `#7d7e80` |
|
||||
| route | 是否开启路由模式 | *boolean* | `false` |
|
||||
| placeholder `v2.6.0` | 固定在底部时,是否在标签位置生成一个等高的占位元素 | *boolean* | `false` |
|
||||
| safe-area-inset-bottom | 是否开启[底部安全区适配](#/zh-CN/quickstart#di-bu-an-quan-qu-gua-pei),设置 fixed 时默认开启 | *boolean* | `false` |
|
||||
| --- | --- | --- | --- |
|
||||
| v-model | 当前选中标签的名称或索引值 | _number \| string_ | `0` |
|
||||
| fixed | 是否固定在底部 | _boolean_ | `true` |
|
||||
| border | 是否显示外边框 | _boolean_ | `true` |
|
||||
| z-index | 元素 z-index | _number \| string_ | `1` |
|
||||
| active-color | 选中标签的颜色 | _string_ | `#1989fa` |
|
||||
| inactive-color | 未选中标签的颜色 | _string_ | `#7d7e80` |
|
||||
| route | 是否开启路由模式 | _boolean_ | `false` |
|
||||
| placeholder `v2.6.0` | 固定在底部时,是否在标签位置生成一个等高的占位元素 | _boolean_ | `false` |
|
||||
| safe-area-inset-bottom | 是否开启[底部安全区适配](#/zh-CN/quickstart#di-bu-an-quan-qu-gua-pei),设置 fixed 时默认开启 | _boolean_ | `false` |
|
||||
|
||||
### Tabbar Events
|
||||
|
||||
| 事件名 | 说明 | 回调参数 |
|
||||
|------|------|------|
|
||||
| 事件名 | 说明 | 回调参数 |
|
||||
| ------ | -------------- | ---------------------------------- |
|
||||
| change | 切换标签时触发 | active: 当前选中标签的名称或索引值 |
|
||||
|
||||
### TabbarItem Props
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|------|------|------|------|
|
||||
| name | 标签名称,作为匹配的标识符 | *number \| string* | 当前标签的索引值 |
|
||||
| icon | [图标名称](#/zh-CN/icon)或图片链接| *string* | - |
|
||||
| icon-prefix `v2.5.3` | 图标类名前缀,同 Icon 组件的 [class-prefix 属性](#/zh-CN/icon#props) | *string* | `van-icon` |
|
||||
| dot | 是否显示图标右上角小红点 | *boolean* | `false` |
|
||||
| badge `v2.5.6` | 图标右上角徽标的内容 | *number \| string* | - |
|
||||
| info | 图标右上角徽标的内容(已废弃,请使用 badge 属性) | *number \| string* | - |
|
||||
| url | 点击后跳转的链接地址 | *string* | - |
|
||||
| to | 点击后跳转的目标路由对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - |
|
||||
| replace | 是否在跳转时替换当前页面历史 | *boolean* | `false` |
|
||||
| --- | --- | --- | --- |
|
||||
| name | 标签名称,作为匹配的标识符 | _number \| string_ | 当前标签的索引值 |
|
||||
| icon | [图标名称](#/zh-CN/icon)或图片链接 | _string_ | - |
|
||||
| icon-prefix `v2.5.3` | 图标类名前缀,同 Icon 组件的 [class-prefix 属性](#/zh-CN/icon#props) | _string_ | `van-icon` |
|
||||
| dot | 是否显示图标右上角小红点 | _boolean_ | `false` |
|
||||
| badge `v2.5.6` | 图标右上角徽标的内容 | _number \| string_ | - |
|
||||
| info | 图标右上角徽标的内容(已废弃,请使用 badge 属性) | _number \| string_ | - |
|
||||
| url | 点击后跳转的链接地址 | _string_ | - |
|
||||
| to | 点击后跳转的目标路由对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | _string \| object_ | - |
|
||||
| replace | 是否在跳转时替换当前页面历史 | _boolean_ | `false` |
|
||||
|
||||
### TabbarItem Slots
|
||||
|
||||
| 名称 | 说明 | SlotProps |
|
||||
|------|------|------|
|
||||
| 名称 | 说明 | SlotProps |
|
||||
| ---- | ---------- | ---------------------- |
|
||||
| icon | 自定义图标 | active: 是否为选中标签 |
|
||||
|
Reference in New Issue
Block a user