yanghao 1 неделя назад
Родитель
Сommit
7d6fb1c530
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      src/components/DeptTreeSelect/index.vue

+ 2 - 1
src/components/DeptTreeSelect/index.vue

@@ -76,7 +76,8 @@ const loadTree = async () => {
   try {
     const { depts, currentId } = await loadDeptData()
     const targetKey = props.modelValue ?? (props.initSelect ? currentId : null)
-    if (props.initSelect && props.modelValue) {
+    // Only initialize the parent value when no external selection was provided.
+    if (props.initSelect && props.modelValue === undefined && currentId !== undefined) {
       emits('update:modelValue', currentId)
     }
     if (targetKey && !expandedKeys.value.includes(targetKey)) {