本文介紹了iview實(shí)現(xiàn)select tree樹(shù)形下拉框的示例代碼,分享給大家,具體如下:
html部分
<Tree :data="treeData" ref="tree" :render="renderContent"></Tree>
數(shù)據(jù)部分
export const treeData= [  {    title: 'parent 1',    expand: true,    selected: true,    value: '1',    children: [      {        title: 'parent 1-1',        expand: true,        value: '11',        children: [          {            value: '111',            title: 'leaf 1-1-1'          },          {            value: '112',            title: 'leaf 1-1-2'          }        ]      },      {        title: 'parent 1-2',        value: '12',        expand: true,        children: [          {            value: '121',            title: 'leaf 1-2-1'          },          {            value: '122',            title: 'leaf 1-2-2'          }        ]      }    ]  }];js部分
// 子節(jié)點(diǎn)的option renderContent (h, { root, node, data }) {      return h('Option', {          style: {            display: 'inline-block',            margin: '0'          },          props:{            value: data.value          }        }, data.title);    },以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持VeVb武林網(wǎng)。
新聞熱點(diǎn)
疑難解答