0
<div class="col-4" v-for="(section,index) in sections" :key="section.id">
    <div class="card">
        <div class="card-header"><h6 v-text="section.name_ar + ' - '+ index"></h6></div>
        <div class="card-body">
            <multiselect :options="packageMeals.filter(x => x.pivot.section_id == section.id && x.pivot.week_index == moment(day.date).format('dddd')).map(x=>x.id)"
                         :custom-label="opt=> packageMeals.find(x=>x.id==opt).name_ar" v-model="meals[index][0]"
            ></multiselect>
        </div>
    </div>
</div>
data: function () {
    return {
        collapse: true,
        meals: new Array(this.sections.length).fill(new Array(3)),
    }
},

mounted() {

},
methods: {
    SaveDay() {

    },
    moment: function (date) {
        return window.moment(date)
    },

},

ここでは、選択したオプションを食事[インデックス] [0]だけにバインドしたいと考えています。たとえば、食事配列のすべての要素にバインドされています。現在、食事[0] [0]、食事[1] [0]、食事[2] [0]、....に結合されているため、食事の入力[0][0] 他のすべての入力が変更されます。

4

0 に答える 0