el-tree 树取消高亮

html 复制代码
 <el-tree
          accordion
          ref="treeRef"
          :data="treedata"
          class="treeRef"
          :current-node-key="currentnode"
          :props="defaultProps"
          highlight-current
          node-key="id"
          :default-expanded-keys="[3, 31, 311]"
          @node-click="handleNodeClick"
        >
          <template #default="{ node }">
            <img
              style="margin-right: 5px"
              :src="treeimgComputed(node.data)"
              alt=""
            />
            <p>{{ node.label }}</p>
          </template>
        </el-tree>
javascript 复制代码
const currentnode: any = ref(null);
const treeRef = ref();
const defaultProps = {
  children: "children",
  label: "label",
};
watch(currentnode, (val) => {
  treeRef.value.setCurrentKey(val);
});
const handleNodeClick = (data: any) => {
  // console.log("打印树:", data);
  currentnode.value = data.id;
  
};

主要代码就是取消高亮把currentnode赋值为null;和监听ref数据

javascript 复制代码
currentnode.value = null;

watch(currentnode, (val) => {
  treeRef.value.setCurrentKey(val);
});

const handleNodeClick = (data: any) => {
  // console.log("打印树:", data);
  currentnode.value = data.id;
   
};
相关推荐
技术砖家--Felix10 小时前
Spring Boot Web开发篇:构建RESTful API
前端·spring boot·restful
yume_sibai11 小时前
TS 常用内置方法
前端·javascript·typescript
新知图书11 小时前
ArkTS语言、基本组成与数据类型
前端·javascript·typescript
西西学代码11 小时前
Flutter---个人信息(1)---实现简单的UI
开发语言·javascript·flutter
嘗_11 小时前
手写自己的小型react
前端·javascript·react.js
嘀咕博客11 小时前
h5游戏免费下载:HTML5拉杆子过关小游戏
前端·游戏·html5
Moonbit11 小时前
MoonBit 推出 LLVM Debugger,核心用户数破十万
前端·编程语言·llvm
zuo-yiran12 小时前
vue div标签可输入状态下实现数据双向绑定
前端·javascript·vue.js
qq_3168377512 小时前
使用leader-line-vue 时垂直元素间距过小连线打转的解决
前端·javascript·vue.js
天天向上102412 小时前
vue3使用ONLYOFFICE 实现在线Word,Excel等文档
前端·javascript·html