import {globalFormValue, ObjectInterface} from '../util' import {computed} from 'vue' // eslint-disable-next-line max-params export default function (modelData: ObjectInterface, model: string, deep: number | undefined, index: number | string = '', row?: ObjectInterface) { const handleModelData = (typeof index === 'number' ? modelData[index] : modelData) as ObjectInterface const modelHook = computed({ get: () => { return globalFormValue(handleModelData, model, deep)._get() }, set: (newValue) => { if (row && !row.noTrim && typeof newValue === 'string') { newValue = newValue.trim() } return globalFormValue(handleModelData, model, deep)._set(newValue) } }) return modelHook }