matiastucci / vue-input-tag

:bookmark: Vue.js 2.0 Input Tag Component
https://tucci.me/vue-input-tag
MIT License
537 stars 130 forks source link

Array with properties On Datasource #84

Closed TioWidow closed 5 years ago

TioWidow commented 6 years ago

Hello, sorry for the inconvenience but I wonder if it is possible to use a Array with properties as a datasource and specify a property of the array as the item that will be the Label of the tag.

Something like in this example:

<input-tag   v-model="datasource" :tags.sync="text" > </input-tag>

datasource: [ {text:'abc', value:123},{text:'zxc', value:456} ]

Version of Vue I'm using?: __2.0___

Version of vue-input-tag I'm using?: _last

Small JSFiddle showing the issue: _____

oakdays commented 6 years ago

@TioWidow If I understood the issue correctly, you could simply use a v-for for that to create a tag for each array element. Then, there would be no need for the feature you proposed.

<input-tag 
  v-for="(obj, index) in array"
  :key="index"
  v-model="obj.value"
  :tags.sync="text">
  {{ obj.text }}
</input-tag>
matiastucci commented 5 years ago

Hi, currently it's not possible to do that. I'm not planning in adding that feature. But you are welcome to create a PR. Thanks!