<el-input placeholder="输入关键字进行过滤"
v-model="filterText"
@input='filterTextchange'
style='margin-bottom: 20px;'>
</el-input>
<el-tree class="filter-tree"
:data="ruleForm.rangeType==10?unionList:industryCategory"
accordion
node-key="id"
show-checkbox
default-expand-all
:default-checked-keys="treekeydata"
:props="defaultProps"
@check="handleCheckChange"
:filter-node-method="filterNode"
ref="tree">
</el-tree>
2 . treekeydata Array tree选中的key
treedata1 Array 右边tree的数据-
选中节点事件
handleCheckChange (data, checked) {
let keyFalg = this.treedata1.findIndex(item => item.code == data.code)
if (keyFalg == -1) {
this.refs.tree.getCheckedKeys(true)
this.treekeydata = this.treedata1.map(item => item.id)},
//右边删除事件
handleClose (data) {
this.treedata1.splice(this.treekeydata.indexOf(data.id), 1)
this.treekeydata.splice(this.treekeydata.indexOf(data.id), 1)this.$refs.tree.setCheckedKeys(this.treekeydata)
},
el-tree 选中取消 回显
image.png
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- element组件的官方文档:https://element.eleme.io/#/zh-CN/component...
- <!-- /** *树形下拉选择组件,下拉框展示树形结构,提供选择某节点功能,方便其他模块调用 *@authorw...
- 今天青石的票圈出镜率最高的,莫过于张艺谋的新片终于定档了。 一张满溢着水墨风的海报一次次的出现在票圈里,也就是老谋...