Answers for "vuejs does props factory function have access to vue instance"

9

vue js default prop

props: {
  name: {
    type: String,
    default: 'John Doe'
  }
}
Posted by: Guest on July-19-2020
1

vuejs does props factory function have access to vue instance

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',
});
Posted by: Guest on August-10-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language