【vue】使用vue+element搭建项目,Tree树形控件使用
目录 一、 安装依赖 二、 常用属性、事件 三、 demo应用 html代码 属性用法 3.2.1 :default-expanded-keys(默认展开项) 3.2.2 :props= "defaultProps" 用法 3.2.3 通过render-content方法定义树节点内容(js代码) 3.2.4 :load="loadChildData" (load 加载子树数据的方法,仅仅当lazy属性为true时生效) (js代码) 3.2.5 @node-click="handleNodeClick" 3.2.6 更新二级数据 3.2.7 接口情况 3.2.8 页面效果图: 一 、安装依赖 本例中,使用render-content进行树节点内容的自定义,因此需要支持JSX语法。(见参考资料第3个) 在Git bash中运行一下指令 cnpm install\ babel-plugin-syntax-jsx\ babel-plugin-transform-vue-jsx\ babel-helper-vue-jsx-merge-props\ babel-preset-es2015\ --save-dev 二、常用属性、事件 常用属性 Attributes(属性名) 描述 type(类型) default(默认值) node-key 每个树节点用来作为唯一标识的属性,