0

I'm not sure if this is the correct way to ask this, but I'm having trouble setting up a v-model that has multiple parts.

v-model="formInputs.input_ + inputType.id"

That would end up being this in the data:

data(){
    return {
        formInputs: {
            input_(its id here): ''
            //example input_5
        },
    }
},

Is it possible to chain values inside a v-model?

RMH
  • 821
  • 2
  • 15
  • 38

1 Answers1

1

You can use [] instead of . as key accessor:

v-model="formInputs['input_' + inputType.id]"
Psidom
  • 209,562
  • 33
  • 339
  • 356