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])
            } 
相关推荐
灵感__idea16 小时前
Hello 算法:贪心的世界
前端·javascript·算法
GreenTea17 小时前
一文搞懂Harness Engineering与Meta-Harness
前端·人工智能·后端
killerbasd19 小时前
牧苏苏传 我不装了 4/7
前端·javascript·vue.js
吴声子夜歌19 小时前
ES6——二进制数组详解
前端·ecmascript·es6
码事漫谈19 小时前
手把手带你部署本地模型,让你Token自由(小白专属)
前端·后端
ZC跨境爬虫19 小时前
【爬虫实战对比】Requests vs Scrapy 笔趣阁小说爬虫,从单线程到高效并发的全方位升级
前端·爬虫·scrapy·html
爱上好庆祝19 小时前
svg图片
前端·css·学习·html·css3
橘子编程20 小时前
JavaScript与TypeScript终极指南
javascript·ubuntu·typescript
王夏奇20 小时前
python中的__all__ 具体用法
java·前端·python
叫我一声阿雷吧20 小时前
JS 入门通关手册(45):浏览器渲染原理与重绘重排(性能优化核心,面试必考
javascript·前端面试·前端性能优化·浏览器渲染·浏览器渲染原理,重排重绘·reflow·repaint