1.1.3 • Published 6 years ago

vue-mixed-props v1.1.3

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

vue-mixed-props

npm npm

Let's say, application has a component, which already has some props defined as an array of strings and it is totally fine for developer or dev team to leave it as it is:

export default {
  name: 'SampleComponent',
  props: [ 'foo', 'bar', 'baz' ]
}

But then, one day, a new prop should be added with type and default value defined. Currently developer has to rewrite existing array of props into object just for adding 1 new prop with default value.

Current plugin allows using mixed array of strings and object for detailed props:

export default {
  name: 'SampleComponent',
  props: [
    'foo',
    'bar',
    'baz',
    {
      tar: {
        type: String,
        default: 'Hi'
      }
    }
  ]
}

Or you can use object for props with array of some string props:

  export default {
    name: 'SampleComponent',
    props: {
      $strings: ['foo', 'bar', 'baz'],
      tar: {
        type: String,
        default: 'Hi'
      }
    }
  }

Usage:

  import Vue from 'vue'
  import MixedProps from 'vue-mixed-props'

  Vue.use(MixedProps)

Plugin works also with SSR.

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago