vue+element 树形组件tree自定义节点
1、下载安装依赖包npm install babel-plugin-syntax-jsx babel-plugin-transform-vue-jsx babel-helper-vue-jsx-merge-props babel-preset-env --save-dev2、项目根目录下新建.babelrc 文件,并写入代码{"presets": [...
·
1、下载安装依赖包
npm install babel-plugin-syntax-jsx babel-plugin-transform-vue-jsx babel-helper-vue-jsx-merge-props babel-preset-env --save-dev
2、项目根目录下新建 .babelrc 文件,并写入代码
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-runtime","transform-vue-jsx"],
"env": {
"test": {
"presets": ["env", "stage-2"],
"plugins": ["transform-vue-jsx","istanbul"]
}
}
}
3、html
<el-tree
:data="item.children"
:render-content="renderContent">
</el-tree>
4、js
methods: {
renderContent(h, {node, data, store}){
return (
<span></span>
);
},
other(){
// some code
},
.......
.......
}
更多推荐
已为社区贡献11条内容
所有评论(0)