引入import Vue from 'vue';
import { TreeSelect } from 'vant';
Vue.use(TreeSelect);
代码演示
单选模式
item为分类显示所需的数据,数据格式见下方示例。main-active-index表示左侧高亮选项的索引,active-id表示右侧高亮选项的 id
:items="items"
:active-id.sync="activeId"
:main-active-index.sync="activeIndex"
/>export default {
data() {
return {
items,
activeId: 1,
activeIndex: 0
};
}
}
多选模式
active-id为数组格式时,可以选中多个右侧选项
:items="items"
:active-id.sync="activeIds"
:main-active-index.sync="activeIndex"
/>export default {
data() {
return {
items,
activeIds: [1, 2],
activeIndex: 0
};
}
}
自定义内容
通过content插槽可以自定义右侧区域的内容
height="55vw"
:items="items"
:main-active-index.sync
1万+




被折叠的 条评论
为什么被折叠?



