fix(ApiSelect): 修复监听不到params的变动

This commit is contained in:
invalid w 2023-12-13 17:35:25 +08:00
parent fdde6f06b2
commit ccf4027533

View File

@ -26,7 +26,7 @@
import type { SelectValue } from 'ant-design-vue/es/select'; import type { SelectValue } from 'ant-design-vue/es/select';
import { isFunction } from '@/utils/is'; import { isFunction } from '@/utils/is';
import { useRuleFormItem } from '@/hooks/component/useFormItem'; import { useRuleFormItem } from '@/hooks/component/useFormItem';
import { get, omit } from 'lodash-es'; import { get, omit, isEqual } from 'lodash-es';
import { LoadingOutlined } from '@ant-design/icons-vue'; import { LoadingOutlined } from '@ant-design/icons-vue';
import { useI18n } from '@/hooks/web/useI18n'; import { useI18n } from '@/hooks/web/useI18n';
import { propTypes } from '@/utils/propTypes'; import { propTypes } from '@/utils/propTypes';
@ -95,8 +95,9 @@
watch( watch(
() => props.params, () => props.params,
() => { (value, oldValue) => {
!unref(isFirstLoaded) && fetch(); if (isEqual(value, oldValue)) return;
fetch();
}, },
{ deep: true, immediate: props.immediate }, { deep: true, immediate: props.immediate },
); );