mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-02-02 18:28:40 +08:00
fix:修复showAdvancedButton为true时,FormSchema中ifshow是与model有关的函数时候,查询按钮位置不重新计算的问题。 (#4304)
This commit is contained in:
parent
6d2de002ef
commit
0cf2271667
@ -124,7 +124,9 @@
|
||||
const getBindValue = computed(() => ({ ...attrs, ...props, ...unref(getProps) }) as AntFormProps);
|
||||
|
||||
const getSchema = computed((): FormSchema[] => {
|
||||
const schemas: FormSchema[] = cloneDeep(unref(schemaRef) || (unref(getProps).schemas as any));
|
||||
const schemas: (FormSchema & { ifshow2?: boolean })[] = cloneDeep(
|
||||
unref(schemaRef) || (unref(getProps).schemas as any),
|
||||
);
|
||||
for (const schema of schemas) {
|
||||
const {
|
||||
defaultValue,
|
||||
@ -134,7 +136,16 @@
|
||||
field,
|
||||
isHandleDefaultValue = true,
|
||||
valueFormat,
|
||||
ifShow,
|
||||
} = schema;
|
||||
|
||||
//fix:修复showAdvancedButton为true时,FormSchema中ifshow是与model有关的函数时候,查询按钮位置不重新计算的问题。
|
||||
if (unref(getProps).showAdvancedButton) {
|
||||
schema.ifshow2 = isFunction(ifShow)
|
||||
? ifShow({ schema, values: formModel, model: formModel, field })
|
||||
: ifShow;
|
||||
}
|
||||
|
||||
// handle date type
|
||||
if (
|
||||
isHandleDateDefaultValue &&
|
||||
|
@ -1,6 +1,15 @@
|
||||
import type { ColEx } from '../types';
|
||||
import type { AdvanceState } from '../types/hooks';
|
||||
import { ComputedRef, getCurrentInstance, Ref, shallowReactive, computed, unref, watch } from 'vue';
|
||||
import {
|
||||
ComputedRef,
|
||||
getCurrentInstance,
|
||||
Ref,
|
||||
shallowReactive,
|
||||
computed,
|
||||
unref,
|
||||
watch,
|
||||
nextTick,
|
||||
} from 'vue';
|
||||
import type { FormProps, FormSchemaInner as FormSchema } from '../types/form';
|
||||
import { isBoolean, isFunction, isNumber, isObject } from '@/utils/is';
|
||||
import { useBreakpoint } from '@/hooks/event/useBreakpoint';
|
||||
@ -49,14 +58,17 @@ export default function ({
|
||||
return 0;
|
||||
});
|
||||
|
||||
const debounceUpdateAdvanced = useDebounceFn(updateAdvanced, 30);
|
||||
// const debounceUpdateAdvanced = useDebounceFn(updateAdvanced, 30);
|
||||
|
||||
watch(
|
||||
[() => unref(getSchema), () => advanceState.isAdvanced, () => unref(realWidthRef)],
|
||||
() => {
|
||||
const { showAdvancedButton } = unref(getProps);
|
||||
if (showAdvancedButton) {
|
||||
debounceUpdateAdvanced();
|
||||
// debounceUpdateAdvanced();
|
||||
nextTick(() => {
|
||||
updateAdvanced();
|
||||
});
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
|
Loading…
Reference in New Issue
Block a user