el-tree清除点击高亮
时间: 2023-10-02 15:06:18 浏览: 323
要清除el-tree中的点击高亮,可以在点击事件的处理函数中将当前节点的key设置为空。例如,可以使用`this.$refs["tree"].setCurrentKey("")`来将当前节点的key置空。这样就能清除点击高亮了。 在代码中,你可以在`handleClickChange`函数中调用这个方法。以下是一个示例代码片段:
```
handleClickChange(data) {
this.$nextTick(() => {
this.$refs["tree"].setCurrentKey("");
});
}
```
请注意,`this.$refs["tree"]`是对el-tree组件的引用,你需要根据你的实际情况进行调整。这样,在点击事件发生后,点击高亮将被清除。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [el-tree点击节点再点击其他地方之前的高亮背景消失解决](https://blog.csdn.net/qq_30351747/article/details/123067271)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [el-tree设置默认高亮,并在点击其他节点后取消高亮](https://blog.csdn.net/qq_43977829/article/details/125443702)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文