vue 3? 綁定props的值類型如string| [] |boolean不定 ts如何處理報(bào)錯(cuò)
如 props的value類型為string | boolean |[]
本子組件需要綁定的類型為[]
處理方法:
重新定義一個(gè)數(shù)據(jù)
let array = ref(props.value) as unkown as Ref<list【】>
先轉(zhuǎn)換成unkown? 再ref成你需要的類型即可
vue 3? 綁定props的值類型如string| [] |boolean不定 ts如何處理報(bào)錯(cuò)
如 props的value類型為string | boolean |[]
本子組件需要綁定的類型為[]
處理方法:
重新定義一個(gè)數(shù)據(jù)
let array = ref(props.value) as unkown as Ref<list【】>
先轉(zhuǎn)換成unkown? 再ref成你需要的類型即可