[Vuejs]-Vue: using a v-for for semi-dynamic object

0👍

U nead something like this:

in vuex:

state: {
       idList: [23,54,66]
   },

in component and in created() method:

 var idList = this.$store.state.idList;
    idList.forEach(el => {
      this.newData.push({
        id: el,
        url: '',
        key: ''
      });
  });

and in component:

<v-checkbox
    class="stream-targets"
    v-for="(target,index) in newData"
    :key="index"
    v-model="locationTarget"
    :value="target"
>
    <template v-slot:label>
       <!-- <span class="check-text" >{{target.id}}</span> -->
       <v-text-field placeholder="URL" v-model='target.url'></v-text-field>
       <v-text-field placeholder="Key" v-model='target.key'></v-text-field>
    </template>
    
</v-checkbox>

Leave a comment