vue---selection下拉级别树选框

npm install --save @riophae/vue-treeselect

// import the component
  import Treeselect from '@riophae/vue-treeselect'
// import the styles
  import '@riophae/vue-treeselect/dist/vue-treeselect.css'


<treeselect
    :multiple="true"
    :options="options"
    :normalizer="normalizer"
    placeholder="Select your favourite(s)..."
    v-model="form.selectTree"
/>

// define the default value
        form:{selectTree:[]},
        normalizer(node) {
            return {
                id: node.id,
                label: node.label,
                children: node.children
            };
        },
        options: [ {
          id: 'a',
          label: 'a',
          children: [ {
            id: 'aa',
            label: 'aa',
          }, {
            id: 'ab',
            label: 'ab',
          } ],
        }, {
          id: 'b',
          label: 'b',
        }, {
          id: 'c',
          label: 'c',
        } ],

<style scoped>
.vue-treeselect__control {
    line-height: 30px;
    font-size: 13px;
}
</style>

 

发布了67 篇原创文章 · 获赞 47 · 访问量 3万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 终极编程指南 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览