首先需要展开所选中的子节点所在的父级,即this.expandedKeys.push(curId);
获取所选中的子节点事件,即可。
this.$nextTick(()=>{ setTimeout(()=>{ this.expandedKeys.push(curId) },500) setTimeout(() => { if(document.getElementsByClassName('ant-tree-treenode-checkbox-checked').length>0){ document.getElementsByClassName('ant-tree-treenode-checkbox-checked')[0].scrollIntoView() } if(document.getElementsByClassName('ant-tree-treenode-selected').length>0){ document.getElementsByClassName('ant-tree-treenode-selected')[0].scrollIntoView() } }, 1000); })