props

props

  • Type: Array | Object

  • Details:

    A list/hash of attributes that are exposed to accept data from the parent component. It has a simple Array-based syntax and an alternative Object-based syntax that allows advanced configurations such as type checking, custom validation and default values.

  • Example:

    // simple syntax
    Vue.component('props-demo-simple', {
      props: ['size', 'myMessage']
    })
    
    // object syntax with validation
    Vue.component('props-demo-advanced', {
      props: {
        // just type check
        size: Number,
        // type check plus other validations
        name: {
          type: String,
          required: true,
          // warn if not two way bound
          twoWay: true
        }
      }
    })
  • See also: Props

doc_VueJS
2016-09-25 05:48:12
Comments
Leave a Comment

Please login to continue.