update 修复 861bug
This commit is contained in:
@@ -206,7 +206,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onBeforeUnmount, nextTick } from 'vue';
|
||||
import { ref, onMounted, onBeforeUnmount, nextTick, watch } from 'vue';
|
||||
import filterProject from '../filterProject/index.vue';
|
||||
import { NODE_TYPE } from '@/utils/enum/node';
|
||||
import { Folder, Document, ScaleToOriginal, Edit } from '@element-plus/icons-vue';
|
||||
@@ -681,7 +681,22 @@ const restoreSelectionFun = () => {
|
||||
if (resetData) {
|
||||
currentNodeInfo.value = resetData;
|
||||
defaultExpandKeys.value = [resetData.id];
|
||||
taskTreeRef.value.setCurrentKey(resetData.id);
|
||||
|
||||
// 修复 861bug 手动触发 nodeChangeClickFun,等待树节点加载
|
||||
const unwatch = watch(
|
||||
() => taskTreeRef.value?.store?.nodesMap,
|
||||
(nodesMap) => {
|
||||
if (nodesMap && nodesMap[resetData.id]) {
|
||||
unwatch();
|
||||
taskTreeRef.value.setCurrentKey(resetData.id);
|
||||
const node = taskTreeRef.value.getNode(resetData.id);
|
||||
if (node) {
|
||||
nodeChangeClickFun(resetData, node);
|
||||
}
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
} else {
|
||||
currentNodeInfo.value = {};
|
||||
defaultExpandKeys.value = [];
|
||||
|
||||
Reference in New Issue
Block a user