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])
            } 
相关推荐
海绵宝龙11 分钟前
前端网页录屏是怎么实现的
前端
勇往直前plus25 分钟前
python格式化字符串
开发语言·前端·python
恋猫de小郭30 分钟前
Flutter 的真正价值是什么?深度解析再结合鸿蒙,告诉你 Flutter 的真正优势
android·前端·flutter
micro_xx31 分钟前
Matlab 有限元分析三维悬臂梁变形
前端·数据库·matlab
web3.088899935 分钟前
获得某红书笔记评论说明-item_review
服务器·前端·数据库
UrbanJazzerati1 小时前
Vue 3 全局错误处理详解与示例
前端
木斯佳1 小时前
前端八股文面经大全:小红书前端日常实习(2026-1-5)·面经深度解析
前端
HelloReader1 小时前
Trunk + Tauri 前端配置Rust/WASM 项目如何稳定接入桌面与移动端(Trunk 0.17.5)
前端
小碗细面1 小时前
告别996!Claude Code 6个实用工作流程
前端·人工智能·ai编程
HelloReader1 小时前
Vite + Tauri 2 一套配置同时搞定桌面开发、调试体验、iOS 真机联调(Vite 5.4.8)
前端