Vue 2 - How to set default type of array in props Vue 2 - How to set default type of array in props vue.js vue.js

Vue 2 - How to set default type of array in props


I created example: jsFiddle, that might can help you, and yes... you can return the default value as a array:

ES6

props: {    items: {        type: Array,        default: () => []    }}


ES6 variety For an Array

props: {  arr: {    type: Array,    default: () => []  }}

...And for an Object

props: {  obj: {    type: Object,    default: () => ({      param: value,      param2: value,    })  }}

A couple related resources:

  1. https://github.com/vue-styleguidist/vue-styleguidist
  2. https://github.com/vuejs/vue/issues/1032