Albert97
Albert97

Reputation: 13

Using v-model to dynamic variable

I am trying to use v-model to spesific properties in an object, but the syntax on v-model is not right. selectBind and values.select is the same length.

var selectBin = ["fileName", "subTitle"]

<b-row v-for="(select, index) in values.selects" :key="select.index">
    <Select
        :label="select.label"
        :index="index"
        :name="select.name"
        :options="select.values"
        v-model="scheduals.data.`${selectBind[index]}`"
        //this should be the same as v-model="scheduals.data.fileName" and v-model="scheduals.data.subTitle"
                                            
 />
</b-row>```

Upvotes: 0

Views: 58

Answers (1)

Boussadjra Brahim
Boussadjra Brahim

Reputation: 1

Try out to access the property using [] accessor :

v-model="scheduals.data[[selectBind][index]]"

Upvotes: 1

Related Questions