关于vue3中对defineProps的约束
interface THeadItem {
key: string
title: string
tooltip?: boolean
width?: string
}
// 指定 需要是键值对的形式 并且value是string(也可以是number等) 解决在xxx上面找不到xxx类型参数的索引签名
interface ListDataItem {
[key: string]: string
}
interface Props {
activeLabel?: string
tHead: Array<THeadItem>
showPagination?: boolean
height?: number
listData: Array<ListDataItem>
}
const props = withDefaults(defineProps<Props>(), {
activeLabel: '',
tHead: () => [],
listData: () => [],
showPagination: false,
height: 700
})

浙公网安备 33010602011771号