示例
封装一个可以刷新多个指定id的节点数据。
html
<template>
<el-tree ref="treeRef"></el-tree>
</template>
<script lang="ts" setup>
const treeRef = ref()
function refreshTreeById(nodeIds: number[]) {
nodeIds.forEach((id: number) => {
const node = treeRef.value?.getNode(id)
if (node) {
node.loaded = false;
node.expand();
}
})
}
</script>