1.字符串数组

defineProps({

acb: Array as () => string[]

})

2.简单对象

defineProps({

company: Object as () => ({name: string, domain: string})

})

3.自定义类型

type Compay={ name:string,domain:string }

defineProps({ compmay: {

type:Object as ()=> Compay

} })

-------------------------------------------------------------

interface Person {

name:string

}

defineProps({

person:{

type:Object as ()=> Person

}

})

4.函数

import { PropType } from 'vue'

type func=(args?: string[])=> string

defineProps({

func:{

type: Function as ()=> PropType

}

})

文章来源

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: