interface IMaintenance {
name: string
}
interface IListDataItem {
id: number | string
serialNo: string
maintenances: IMaintenance[]
}
export default defineComponent(
{
setup() {
const list = reactive(
{
data: [] as IListDataItem[],
return {
list
}
}
}
)
或者:
interface IListDataItem {
names: string[];
serialNo: string;
Fun: (index: number) => void;
}
export default {
name: 'App',
setup () {
const data: IListDataItem = reactive({
names: ['coco', 'xx', 'zz'],
serialNo: '',
Fun: (index: number) => {
data. serialNo = data.names[index]
}
})
return {
data
}
}
}