ts + vue3 + antdv@^3.0.0 (Select选择器)
1,像这样的数据,在ts里怎么定义?
2,还有怎么像这样去匹配:
console.log( searchConditionList[props.title] )
const sameKeyValue = {
'高级筛选': '高级筛选'
}
const searchConditionList = {
'高级筛选': [
{ title: '不限', value: '', checked: true },
{ title: '推广商品数', data: [{ title: '选项一', checked: true }, { title: '选项二', checked: true }, { title: '选项三', checked: true }], checked: false },
{ title: '关联视频数', data: [{ title: '选项一', checked: true }, { title: '选项二', checked: true }, { title: '选项三', checked: true }], checked: false },
{ title: '关联直播数', data: [{ title: '选项一', checked: true }, { title: '选项二', checked: true }, { title: '选项三', checked: true }], checked: false }
]
}
export {
sameKeyValue,
searchConditionList
}
试试这样定义类型: searchConditionList: {
[key: string]: any;
}
定义数据就这样就好了,最多加一个const searchConditionList:object={}。props.title是searchConditionList的key就行