el-tree树状控件,定位到选中的节点的位置

效果图

在el-tree 控件加**:render-content="renderContent"**

在掉接口的方法中

实际有用的是setTimeout 方法和this.$refs.xxxxxx.setCheckedKeys([industrycodeList])

复制代码
if(res.data.swindustrylist.length>0){
              res.data.swindustrylist.forEach(item => {
                industrycodeList.push(item.industrycode) 
                setTimeout(() => { 
                  const currentDom = document.querySelector('#A' + item.industrycode)
                  console.log('industrycodeList',industrycodeList)
                  console.log('item.industrycode',item.industrycode)
                  if (currentDom) {
                      currentDom.scrollIntoView()
                  } 
                }, 1000)
              }) 
              this.$refs.mappTree.setCheckedKeys([industrycodeList])
            } 
相关推荐
程序员爱钓鱼3 分钟前
Node.js 编程实战:前后端结合 - 前端静态资源优化
前端·后端·node.js
大爱编程♡6 分钟前
JAVAEE-Spring Web MVC
前端·spring·java-ee
程序员爱钓鱼7 分钟前
Node.js 编程实战:前后端结合 - 跨域与代理配置
前端·后端·node.js
涂山小楼8 分钟前
线程join()方法的深度理解
java·前端·算法
烈焰飞鸟11 分钟前
华为云前后端部署实战手册
运维·前端·vue.js·后端·华为云
挨踢攻城12 分钟前
Linux 下合并多个 PDF 文件为一个 PDF 文件的方法
linux·前端·rhce·rhca·linux运维·红帽认证·公众号:厦门微思网络
怕浪猫15 分钟前
React从入门到出门第三章 虚拟 DOM 与并发渲染基础
前端·javascript·react.js
wniuniu_17 分钟前
ceph的osd
java·前端·ceph
他是龙55120 分钟前
55:XSS防御机制与绕过实战(CSP+HttpOnly+Filter)
前端·chrome·xss
名誉寒冰25 分钟前
基于 React + Three.js + 大模型的全息地球 Web 项目(水个web课程设计)
前端·javascript·react.js·ai编程