情况1:
interface workLinkArrType {
title: string
des: string
path?: string
}
interface workLinkType {
[index: number]: Array<workLinkArrType>
}
let workLink: workLinkType = [
[
{ title: '扫码打包已完成', des: '16单' },
{ title: '扫码打包已完成', des: '16单' }
],
[{ title: '扫码打包已完成', des: '16单' }]
]
情况2:
interface workLinkArrType {
_id: number;
roleName: string;
}
interface interrolelist {
[index: number]: workLinkArrType
}
let roleList: interrolelist = []
roleList = [{
_id: 1,
roleName: 'lee'
},
{
_id: 2,
roleName: 'lsanee'
}]
情况3:在vue3中
interface workLinkArrType {
_id: number;
roleName: string;
}
interface interrolelist {
[index: number]: workLinkArrType
}
let roleList=ref<interrolelist>([])
roleList = [{
_id: 1,
roleName: 'lee'
},
{
_id: 2,
roleName: 'lsanee'
}]