代码
interface editFormDataType {
label: string | number | boolean
value: string | number | boolean
prop: string
}
editFormData
方法一: ref
const editFormData = ref([] as editFormDataType[])
editFormData.value = [
{
label: '客户名称',
value: '',
prop: ''
},
{
label: '单号',
value: '',
prop: ''
}
]
方法二: reactive
const editFormData: editFormDataType[] = reactive([])
editFormData.push(
...[
{
label: '客户名称',
value: '',
prop: ''
},
{
label: '单号',
value: '',
prop: ''
}
]
)
editFormData.splice(0, 1, {
label: '备注',
value: '',
prop: ''
})
editFormData.length = 0;
方法三: reactive
const state = reactive({
editFormData: [] as editFormDataType[]
})
state.editFormData = [
{
label: '客户名称',
value: '',
prop: ''
},
{
label: '单号',
value: '',
prop: ''
}
]