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])
            } 
相关推荐
张就是我1065921 分钟前
漏洞复现指南:利用 phpinfo() 绕过 HttpOnly Cookie 保护
前端
Kagol6 分钟前
🎉TinyVue v3.27.0 正式发布:增加 Space 新组件,ColorPicker 组件支持线性渐变
前端·vue.js·typescript
潍坊老登6 分钟前
大前端框架汇总/产品交互参考UE
前端
方安乐13 分钟前
获取URL参数如何避免XSS攻击
前端·xss
十二AI编程26 分钟前
MiniMax M2.1 实测,多语言编程能力表现出色!
前端
鹿野素材屋1 小时前
技术闲聊:为什么网游会在固定时间点,刷出固定的道具?
前端·网络·unity
同学807961 小时前
🔥🔥高效易用的 Vue3 公告滚动组件:打造丝滑的内容滚动体验(附源码)
前端·vue.js
编程修仙1 小时前
第二篇 Vue指令
前端·javascript·vue.js·前端框架
frontend丶CV1 小时前
useMemo
前端·react.js