propsData

propsData

1.0.22+

  • Type: Object

  • Restriction: only respected in instance creation via new.

  • Details:

    Pass props to an instance during its creation. This is primarily intended to make unit testing easier.

  • Example:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    var Comp = Vue.extend({
      props: ['msg'],
      template: '<div>{{ msg }}</div>'
    })
     
    var vm = new Comp({
      propsData: {
        msg: 'hello'
      }
    })
doc_VueJS
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.