feat(TreeSelect): add dot option (#4433)

This commit is contained in:
neverland
2019-09-11 17:55:28 +08:00
committed by GitHub
parent b1f01c2fb7
commit b279408e10
5 changed files with 96 additions and 17 deletions
+28 -8
View File
@@ -64,14 +64,8 @@ export default {
:main-active-index.sync="activeIndex"
>
<template slot="content">
<van-image
v-if="activeIndex === 0"
src="https://img.yzcdn.cn/vant/apple-1.jpg"
/>
<van-image
v-if="activeIndex === 1"
src="https://img.yzcdn.cn/vant/apple-2.jpg"
/>
<van-image v-if="activeIndex === 0" src="https://img.yzcdn.cn/vant/apple-1.jpg" />
<van-image v-if="activeIndex === 1" src="https://img.yzcdn.cn/vant/apple-2.jpg" />
</template>
</van-tree-select>
```
@@ -87,6 +81,30 @@ export default {
}
```
### Show Info
```html
<van-tree-select
height="55vw"
:items="items"
:main-active-index.sync="activeIndex"
/>
```
```js
export default {
data() {
return {
activeIndex: 0,
items: [
{ text: 'Group 1', children: [], dot: true },
{ text: 'Group 2', children: [], info: 5 }
]
}
}
}
```
## API
### Props
@@ -125,6 +143,8 @@ In every tree object, `text` property defines `id` stands for the unique key whi
text: 'Group 1',
// info
info: 3,
// Whether to show red dot
dot: true,
// leaves of this parent node
children: [
{