vue3的ref变量声明类型注解
1使用默认类型
const str = ref("") str.value = 'tom
2 //使用泛型
const num = ref<number>() num.value = 20
type GoodType = { id: string name: string price: number } const goodList = ref<GoodType[]>([])
3 使用类型断言
type GoodType = { id: string name: string price: number } const goodLists = ref([] as GoodType[])