fix: useParseDefaultValue (#3264)
This commit is contained in:
parent
894e1c8bf8
commit
641ca2dcca
@ -115,19 +115,27 @@ const useParseDefaultValue = () => {
|
|||||||
_run();
|
_run();
|
||||||
|
|
||||||
// 实现联动的效果,当依赖的变量变化时(如 `$nForm` 变量),重新解析默认值
|
// 实现联动的效果,当依赖的变量变化时(如 `$nForm` 变量),重新解析默认值
|
||||||
const dispose = reaction(() => {
|
const dispose = reaction(
|
||||||
const obj = { [variableName]: variable?.ctx || {} };
|
() => {
|
||||||
const path = getPath(fieldSchema.default);
|
const obj = { [variableName]: variable?.ctx || {} };
|
||||||
const value = getValuesByPath(obj, path);
|
const path = getPath(fieldSchema.default);
|
||||||
|
const value = getValuesByPath(obj, path);
|
||||||
|
// fix https://nocobase.height.app/T-2212
|
||||||
|
if (value === undefined) {
|
||||||
|
// 返回一个随机值,确保能触发 run 函数
|
||||||
|
return Math.random();
|
||||||
|
}
|
||||||
|
|
||||||
// fix https://nocobase.height.app/T-2212
|
return value;
|
||||||
if (value === undefined) {
|
},
|
||||||
// 返回一个随机值,确保能触发 run 函数
|
_run,
|
||||||
return Math.random();
|
{
|
||||||
}
|
equals: (oldValue, newValue) => {
|
||||||
|
field.setValue(newValue);
|
||||||
return value;
|
return oldValue === newValue;
|
||||||
}, run);
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
return dispose;
|
return dispose;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ export {
|
|||||||
useInheritsTableColumnInitializerFields,
|
useInheritsTableColumnInitializerFields,
|
||||||
useRecordCollectionDataSourceItems,
|
useRecordCollectionDataSourceItems,
|
||||||
useRemoveGridFormItem,
|
useRemoveGridFormItem,
|
||||||
useTableColumnInitializerFields
|
useTableColumnInitializerFields,
|
||||||
} from './utils';
|
} from './utils';
|
||||||
|
|
||||||
export class SchemaInitializerPlugin extends Plugin {
|
export class SchemaInitializerPlugin extends Plugin {
|
||||||
|
Loading…
Reference in New Issue
Block a user