Vue属性——Props中如何接收不同类型的数据

字符串接收、布尔值接收、数值接收、数组接收、对象接收    props例子:

props: {
    stringVal:{
        type: String,
        default: '字符串变量默认值'
    },
    booleanVal:{
        type: Boolean,
        default: false
    },
    numberVal:{
        type: Number,
        default: 0
    },
    listVal:{
        type: Array,
        default: () => []
    },
    objectVal:{
        type: Object,
        default: ()=> {}
    },
}

 

posted @ 2021-04-01 13:21  㭌(mou)七  阅读(2234)  评论(2)    收藏  举报