0

I currently have:

<div id="fields" v-for="(key, field) in ui.account.search_field_url_map" v-bind:key="field.stageName">
   <h2>{{meta.account[field]}}</h2> 
   <input type="text" :v-model="search.field = field" :name="field" placeholder="John">
</div>

This div loads data with v-for this object has a key that I want to be able to use inside of my v-model where data is, inside my data I have:

data(){
    search: {}
}

I want to create objects inside of search based on the data that is being passed through the v-for

Right now if I do

:v-model="search.field = field" I get:

field: "BillingCity"

But I want it to be:

BillingCity: "Whatever input from the form here"

How can I do this?

3
  • You're using v-model wrong, it is v-model="search.field" vuejs.org/v2/guide/forms.html Commented Apr 8, 2019 at 22:53
  • That didnt work, it just did field: '' Commented Apr 8, 2019 at 23:24
  • Doing v-model="search[field]" did the trick! Commented Apr 8, 2019 at 23:36

1 Answer 1

2

Doing:

v-model="search[field]"

did the trick for me

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.