跳到主要内容

Vue3

一、Props

1.1 校验map映射


描述: 组件该如何接收父组件传入的一个映射为stable|pre|online的类型值呢?

props: {
env: {
type: String as PropType<'stable'|"pre"|'online'>,
default: 'stable',
}
},

1.2 校验对象数组


描述: 组件该如何接收父组件传入的一个对象数组呢?

props: {
list: {
type: Array as PropType<CommonList>,
required:true,
default: () => {
return [];
}
}
}