0
Q:

vuejs does props factory function have access to vue instance

props: {
  name: {
    type: String,
    default: 'John Doe'
  }
}
4
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',
});
1

New to Communities?

Join the community