Customize the `type` of props.

when viewing ide/components.html-sharpProp" rel=" nofollow noreferrer "> Props ,

type of
props can also be a custom constructor function that uses instanceof detection.

how to do this sentence?

for example, I have one:
propB: [String, Number]

so how do you implement one of the above custom constructors to define types?

Feb.28,2021

I just read it wrong. In fact, you define a function to detect parameters. The following means that the incoming data must have two attributes, name and age.

function Person(name, age) {
    this.name = name
    this.age = age
}

props:{
    data:{
       type: Person,
       required: true,
       default: 1
    }
}
Menu