vue中如何使用ztree
下面给大家介绍vue ztree 结合使用方法,一起看看吧!
配置package.json
打包下载jquery以及ztree
"dependencies": { "element-ui": "^2.1.0", "vue": "^2.5.2", "axios": "^0.16.1", "jquery":"3.3.1", "vue-awesome":"2.3.4", "ztree":"3.5.24" },
自动加载jquery
项目build的时候自动加载jquery,并且输出到jQuery中,在ztree中会使用到jQuery。
plugins: [ new webpack.ProvidePlugin({ jQuery:'jquery', $:'jquery', }) ]
import jquery以及ztree
import 'jquery' import 'ztree' import 'ztree/css/metroStyle/metroStyle.css'
调用ztree生成树形结构
export default { data() { return { nodeData: [{ name: "父节点1", children: [ {name: "子节点1"}, {name: "子节点2"} ] }], setting:{ view: { showLine: false }, data: { simpleData: { enable: true } }, callback: { onClick: this.getFileDesc } } } }, mounted(){ let nodeData = this.nodeData $.fn.zTree.init($("#uploadtree"), this.setting, nodeData); } }
总结
相关推荐
83493467 2014-01-13
小源丶同学 2015-03-04
83443560 2018-12-05
xchrist 2016-03-03
LingPF 2019-06-30
shanhuijava 2015-12-11
火星的你 2015-07-10
88463368 2015-03-04
Chydar 2019-06-27
CrazyDogWang 2014-08-20
罗惠东 2014-03-09
asdjkl 2014-01-13
kbkiss 2019-06-26
愚盦 2013-10-21
zgwyfz 2013-09-14
momode 2013-06-28
84483368 2013-06-02