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])
            } 
相关推荐
Coding_Doggy21 分钟前
链盾shieldchain | 项目管理、DID操作、DID密钥更新消息定时提醒
java·服务器·前端
用户214118326360233 分钟前
dify案例分享-国内首发!手把手教你用Dify调用Nano Banana2AI画图
前端
wa的一声哭了41 分钟前
Webase部署Webase-Web在合约IDE页面一直转圈
linux·运维·服务器·前端·python·区块链·ssh
GISer_Jing1 小时前
3D Cesium渲染架剖析
javascript·3d·webgl
han_1 小时前
前端性能优化之CSS篇
前端·javascript·性能优化
k***85841 小时前
【SpringBoot】【log】 自定义logback日志配置
android·前端·后端
小满zs1 小时前
Next.js第十章(Proxy)
前端
JIngJaneIL1 小时前
汽车租赁|汽车管理|基于Java+vue的汽车租赁系统(源码+数据库+文档)
java·vue.js·spring boot·汽车·论文·毕设·汽车租赁
z***I3942 小时前
JavaScript爬虫应用案例
开发语言·javascript·爬虫
d***9352 小时前
Webpack、Vite区别知多少?
前端·webpack·node.js