yanghao hai 1 semana
pai
achega
7d6fb1c530
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  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)) {