feat(form): type配置为函数时,参数中的model等对象设置层readonly

This commit is contained in:
roymondchen 2026-01-07 14:43:14 +08:00
parent 5267381ebf
commit df611571c7

View File

@ -16,6 +16,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { readonly } from 'vue';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc'; import utc from 'dayjs/plugin/utc';
import { cloneDeep } from 'lodash-es'; import { cloneDeep } from 'lodash-es';
@ -209,10 +210,10 @@ export const filterFunction = <T = any>(
) => { ) => {
if (typeof config === 'function') { if (typeof config === 'function') {
return (config as FilterFunction<T>)(mForm, { return (config as FilterFunction<T>)(mForm, {
values: mForm?.initValues || {}, values: readonly(mForm?.initValues || {}),
model: props.model, model: readonly(props.model),
parent: mForm?.parentValues || {}, parent: readonly(mForm?.parentValues || {}),
formValue: mForm?.values || props.model, formValue: readonly(mForm?.values || props.model),
prop: props.prop, prop: props.prop,
config: props.config, config: props.config,
index: props.index, index: props.index,