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])
            } 
相关推荐
一只大侠的侠21 分钟前
React Native for OpenHarmony:DatePicker 日期选择器组件详解
javascript·react native·react.js
JosieBook25 分钟前
【Vue】15 Vue技术——Vue计算属性简写:提升代码简洁性的高效实践
前端·javascript·vue.js
rfidunion1 小时前
springboot+VUE+部署(11。Nginx)
linux·vue.js·nginx
weixin199701080161 小时前
Lazada商品详情页前端性能优化实战
前端·性能优化
x-cmd1 小时前
[x-cmd] Node.js 的关键一步:原生运行 TypeScript 正式进入 Stable
javascript·typescript·node.js·x-cmd
星火开发设计1 小时前
异常规范与自定义异常类的设计
java·开发语言·前端·c++
CappuccinoRose2 小时前
CSS 语法学习文档(十一)
前端·css·学习·表单控件
海兰2 小时前
Elastic Stack 9.3.0 日志探索
java·服务器·前端
御坂10101号2 小时前
JIT 上的 JIT:Elysia JS 的优化实践与争议
开发语言·javascript·网络·性能优化·node.js·express
一只大侠的侠3 小时前
React Native实战:高性能Popover弹出框组件
javascript·react native·react.js