<template>
<div>
<el-tree
:props="defaultProps"
:load="loadNode"
lazy
ref="tree"
show-checkbox
node-key="comcode" // 看项目和数据而定,有的为id
:check-strictly="true"
@check-change="handleCheckChange"
@node-click="nodeClick"
>
</el-tree>
</div>
</template>
<script>
methods:{
handleClick(data, checked, node){
if(checked == true){
this.checkedId = data.comcode;
this.$refs.tree.setCheckedNodes([data]);
}
},
nodeClick(data,checked,node){
this.checkedId = data.comcode
this.$refs.tree.setCheckedNodes([data]);
}
}
</script>
element-ui组件el-tree实现单选(项目实战通过)
原创wx5ee83f8027ac0 ©著作权
©著作权归作者所有:来自51CTO博客作者wx5ee83f8027ac0的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
html引用template
1.引用外部脚本: <script language="language" src="URL"></script>如: <script language="javascript" src="1.js"></script> 2.输入空格符号:    
html引用template 人工智能 javascript ViewUI 项目一