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])
            } 
相关推荐
山川行几秒前
Python快速闯关8:内置函数
java·开发语言·前端·笔记·python·学习·visual studio
还是大剑师兰特24 分钟前
将 Utils.js 挂载为全局(window.Utils.xx)完整配置方案
开发语言·javascript·ecmascript
徐小夕34 分钟前
花了一周时间,我们开源了一款PDF编辑SDK,支持在线批注+脱敏
前端·vue.js·github
前端Hardy38 分钟前
Qwik 2.0 Beta 来了:不靠 AI,只靠 Resumability,首屏交互快到离谱
前端·javascript·面试
1-1=01 小时前
ExtJS 快速入门—— 面板 详细版
前端·jquery
前端攻城狮Qwen1 小时前
Service Worker在电子菜单中的实际应用
前端
前端Hardy1 小时前
NW.js v0.109.1 最新稳定版发布:被遗忘的桌面开发神器?启动快 3 倍,内存省 70%!
前端·javascript·vue.js
Kath1 小时前
[归档][2022-05-16]opensumi看码记录
前端
清风徐来QCQ1 小时前
跨域问题(CORS-Cross-Origin Resource Sharing跨域资源共享)
前端
DanCheOo1 小时前
我写了一个 AI 代码质量流水线,一行命令搞定 Review + 修复 + 测试 + 报告
前端·ai编程