Prop Default Vue JS
props: {
name: {
type: String,
default: 'John Doe'
}
}
garzj
props: {
name: {
type: String,
default: 'John Doe'
}
}
Vue.component('foo', {
template: '<div>{{ num }}</div>',
props: {
func: {
type: Number,
default: () => this.a,
},
},
data() {
return {
num: this.func(),
a: -22
}
}
})
new Vue({
el: '#app',
});