In typescript, i have seen the prop is initialized like this below in vue component.
@Prop({ type: Object }) tabDetails: tabDetailsTypes
This tabDetailsTypes is like :
export interface tabDetailsTypes {
label: string
name: string
count: number | string
Same thing i want to create prop in vue component by using JavaScript like this.
props: {
serverUrls: {
required: true,
type: Object,
default: () => {
label: '',
name: '',
count: 1
}
}
}
It is correct syntax or what is the correct syntax for this?
default: () => ({ ... }). Another way is usingreturnstatement:default: () => { return { ... } };