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;
   
};
相关推荐
暮雪倾风1 小时前
【JS-Node】node.js环境安装及使用
开发语言·javascript·node.js
发现一只大呆瓜8 小时前
深度解密 Rollup 插件开发:核心钩子函数全生命周期图鉴
前端·vite
java_nn9 小时前
一文了解前端技术
前端
发现一只大呆瓜9 小时前
深度解析 Rollup 配置与 Vite 生产构建流程
前端·vite
小码哥_常9 小时前
安卓黑科技:让手机成为你的“跌倒保镖”
前端
小李子呢021110 小时前
前端八股Vue---Vue2和Vue3的区别,set up的用法
前端·javascript·vue.js
m0_6470579610 小时前
Harness Engineering 实践指南
前端
邂逅星河浪漫10 小时前
【银行内网开发-管理端】Vue管理端+Auth后台开发+Nginx配置+Linux部署(详细解析)
linux·javascript·css·vue.js·nginx·html·前后端联调
JJay.10 小时前
Android BLE 稳定连接的关键,不是扫描,而是 GATT 操作队列
android·服务器·前端
一 乐10 小时前
电影院|基于springboot + vue电影院购票管理系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·论文·毕设·电影院购票管理管理系统