create vue.js v-model from dynamci value2019 Community Moderator ElectionCall a Vue.js component method from outside the componentvue.js disable input conditionallyOn-page data entry interaction with Vue.jsVue.js - How to properly watch for nested dataVue.js—Difference between v-model and v-bindOnly call method when a human changes an input - not when the method changes the input in Vue.jsHow to get the values from the DOM controls when the models are created dynamically using vuejsBootstrapVue control columns number in form groupMultiple Dynamic Checkboxes with input groups in vue jscreate highly dynamic input form components
Has Wakanda ever accepted refugees?
Can a Trickery Domain cleric cast a spell through the Invoke Duplicity clone while inside a Forcecage?
Ahoy, Ye Traveler!
Would the melodic leap of the opening phrase of Mozart's K545 be considered dissonant?
Is divide-by-zero a security vulnerability?
An Undercover Army
How can I be pwned if I'm not registered on the compromised site?
Create chunks from an array
If nine coins are tossed, what is the probability that the number of heads is even?
Why won't the strings command stop?
Split a number into equal parts given the number of parts
Difference between 'stomach' and 'uterus'
A bug in Excel? Conditional formatting for marking duplicates also highlights unique value
Is every open circuit a capacitor?
Make me a metasequence
Caulking a corner instead of taping with joint compound?
How can neutral atoms have exactly zero electric field when there is a difference in the positions of the charges?
Are small insurances worth it
When was drinking water recognized as crucial in marathon running?
Can we carry rice to Japan?
Are there other characters in the Star Wars universe who had damaged bodies and needed to wear an outfit like Darth Vader?
Should I use HTTPS on a domain that will only be used for redirection?
Can an earth elemental drown/bury its opponent underground using earth glide?
Wardrobe above a wall with fuse boxes
create vue.js v-model from dynamci value
2019 Community Moderator ElectionCall a Vue.js component method from outside the componentvue.js disable input conditionallyOn-page data entry interaction with Vue.jsVue.js - How to properly watch for nested dataVue.js—Difference between v-model and v-bindOnly call method when a human changes an input - not when the method changes the input in Vue.jsHow to get the values from the DOM controls when the models are created dynamically using vuejsBootstrapVue control columns number in form groupMultiple Dynamic Checkboxes with input groups in vue jscreate highly dynamic input form components
I am generating a some checkbox dynamically. Now I need to create v-model dynamic.
<div class="form-group input-group">
<label class="form-group-title">DIETARY PREFERENCES</label>
<p>Please mark appropriate boxes if it applies to you and/or your family</p>
<div class="check-group" v-for="v in alldietry" :key="v">
<input type="checkbox" v-model="userinfo.#Here will be the value" value="" id="Vegetarian">
<label for="Vegetarian">v.title</label>
</div>
</div>
into the v-model
I have try v-model="userinfo.xyz"
its shows error.
vue.js nuxt
add a comment |
I am generating a some checkbox dynamically. Now I need to create v-model dynamic.
<div class="form-group input-group">
<label class="form-group-title">DIETARY PREFERENCES</label>
<p>Please mark appropriate boxes if it applies to you and/or your family</p>
<div class="check-group" v-for="v in alldietry" :key="v">
<input type="checkbox" v-model="userinfo.#Here will be the value" value="" id="Vegetarian">
<label for="Vegetarian">v.title</label>
</div>
</div>
into the v-model
I have try v-model="userinfo.xyz"
its shows error.
vue.js nuxt
add a comment |
I am generating a some checkbox dynamically. Now I need to create v-model dynamic.
<div class="form-group input-group">
<label class="form-group-title">DIETARY PREFERENCES</label>
<p>Please mark appropriate boxes if it applies to you and/or your family</p>
<div class="check-group" v-for="v in alldietry" :key="v">
<input type="checkbox" v-model="userinfo.#Here will be the value" value="" id="Vegetarian">
<label for="Vegetarian">v.title</label>
</div>
</div>
into the v-model
I have try v-model="userinfo.xyz"
its shows error.
vue.js nuxt
I am generating a some checkbox dynamically. Now I need to create v-model dynamic.
<div class="form-group input-group">
<label class="form-group-title">DIETARY PREFERENCES</label>
<p>Please mark appropriate boxes if it applies to you and/or your family</p>
<div class="check-group" v-for="v in alldietry" :key="v">
<input type="checkbox" v-model="userinfo.#Here will be the value" value="" id="Vegetarian">
<label for="Vegetarian">v.title</label>
</div>
</div>
into the v-model
I have try v-model="userinfo.xyz"
its shows error.
vue.js nuxt
vue.js nuxt
asked 19 hours ago
mad maxmad max
330112
330112
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
To bind dynamic object to model, you need to access to key shared by the model value and the set of data used to display your list.
let vm = new Vue(
el: '#app',
data:
userinfo:
0: '',
1: ''
,
computed:
alldietry()
return [
id: 0,
title: 'Title'
,
id: 1,
title: 'Title'
]
)
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app" class="form-group input-group">
<label class="form-group-title">DIETARY PREFERENCES</label>
<p>Please mark appropriate boxes if it applies to you and/or your family</p>
<div class="check-group" v-for="(v, index) in alldietry" :key="index">
<input type="checkbox" v-model="userinfo[v.id]" value="" :id="v.id">
<label :for="v.id">v.title</label>
</div>
userinfo
</div>
add a comment |
You can't use
interpolation inside attributes.
The v-model
value is a javascript expression, so instead of
v-model="userinfo.xyz"
you can just do
v-model="userinfo[xyz]"
as you would normally do in javascript when accessing an arbitrary property of an object.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55021522%2fcreate-vue-js-v-model-from-dynamci-value%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
To bind dynamic object to model, you need to access to key shared by the model value and the set of data used to display your list.
let vm = new Vue(
el: '#app',
data:
userinfo:
0: '',
1: ''
,
computed:
alldietry()
return [
id: 0,
title: 'Title'
,
id: 1,
title: 'Title'
]
)
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app" class="form-group input-group">
<label class="form-group-title">DIETARY PREFERENCES</label>
<p>Please mark appropriate boxes if it applies to you and/or your family</p>
<div class="check-group" v-for="(v, index) in alldietry" :key="index">
<input type="checkbox" v-model="userinfo[v.id]" value="" :id="v.id">
<label :for="v.id">v.title</label>
</div>
userinfo
</div>
add a comment |
To bind dynamic object to model, you need to access to key shared by the model value and the set of data used to display your list.
let vm = new Vue(
el: '#app',
data:
userinfo:
0: '',
1: ''
,
computed:
alldietry()
return [
id: 0,
title: 'Title'
,
id: 1,
title: 'Title'
]
)
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app" class="form-group input-group">
<label class="form-group-title">DIETARY PREFERENCES</label>
<p>Please mark appropriate boxes if it applies to you and/or your family</p>
<div class="check-group" v-for="(v, index) in alldietry" :key="index">
<input type="checkbox" v-model="userinfo[v.id]" value="" :id="v.id">
<label :for="v.id">v.title</label>
</div>
userinfo
</div>
add a comment |
To bind dynamic object to model, you need to access to key shared by the model value and the set of data used to display your list.
let vm = new Vue(
el: '#app',
data:
userinfo:
0: '',
1: ''
,
computed:
alldietry()
return [
id: 0,
title: 'Title'
,
id: 1,
title: 'Title'
]
)
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app" class="form-group input-group">
<label class="form-group-title">DIETARY PREFERENCES</label>
<p>Please mark appropriate boxes if it applies to you and/or your family</p>
<div class="check-group" v-for="(v, index) in alldietry" :key="index">
<input type="checkbox" v-model="userinfo[v.id]" value="" :id="v.id">
<label :for="v.id">v.title</label>
</div>
userinfo
</div>
To bind dynamic object to model, you need to access to key shared by the model value and the set of data used to display your list.
let vm = new Vue(
el: '#app',
data:
userinfo:
0: '',
1: ''
,
computed:
alldietry()
return [
id: 0,
title: 'Title'
,
id: 1,
title: 'Title'
]
)
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app" class="form-group input-group">
<label class="form-group-title">DIETARY PREFERENCES</label>
<p>Please mark appropriate boxes if it applies to you and/or your family</p>
<div class="check-group" v-for="(v, index) in alldietry" :key="index">
<input type="checkbox" v-model="userinfo[v.id]" value="" :id="v.id">
<label :for="v.id">v.title</label>
</div>
userinfo
</div>
let vm = new Vue(
el: '#app',
data:
userinfo:
0: '',
1: ''
,
computed:
alldietry()
return [
id: 0,
title: 'Title'
,
id: 1,
title: 'Title'
]
)
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app" class="form-group input-group">
<label class="form-group-title">DIETARY PREFERENCES</label>
<p>Please mark appropriate boxes if it applies to you and/or your family</p>
<div class="check-group" v-for="(v, index) in alldietry" :key="index">
<input type="checkbox" v-model="userinfo[v.id]" value="" :id="v.id">
<label :for="v.id">v.title</label>
</div>
userinfo
</div>
let vm = new Vue(
el: '#app',
data:
userinfo:
0: '',
1: ''
,
computed:
alldietry()
return [
id: 0,
title: 'Title'
,
id: 1,
title: 'Title'
]
)
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app" class="form-group input-group">
<label class="form-group-title">DIETARY PREFERENCES</label>
<p>Please mark appropriate boxes if it applies to you and/or your family</p>
<div class="check-group" v-for="(v, index) in alldietry" :key="index">
<input type="checkbox" v-model="userinfo[v.id]" value="" :id="v.id">
<label :for="v.id">v.title</label>
</div>
userinfo
</div>
answered 19 hours ago
Adrien RosiAdrien Rosi
1344
1344
add a comment |
add a comment |
You can't use
interpolation inside attributes.
The v-model
value is a javascript expression, so instead of
v-model="userinfo.xyz"
you can just do
v-model="userinfo[xyz]"
as you would normally do in javascript when accessing an arbitrary property of an object.
add a comment |
You can't use
interpolation inside attributes.
The v-model
value is a javascript expression, so instead of
v-model="userinfo.xyz"
you can just do
v-model="userinfo[xyz]"
as you would normally do in javascript when accessing an arbitrary property of an object.
add a comment |
You can't use
interpolation inside attributes.
The v-model
value is a javascript expression, so instead of
v-model="userinfo.xyz"
you can just do
v-model="userinfo[xyz]"
as you would normally do in javascript when accessing an arbitrary property of an object.
You can't use
interpolation inside attributes.
The v-model
value is a javascript expression, so instead of
v-model="userinfo.xyz"
you can just do
v-model="userinfo[xyz]"
as you would normally do in javascript when accessing an arbitrary property of an object.
answered 18 hours ago
Decade MoonDecade Moon
13.4k32455
13.4k32455
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55021522%2fcreate-vue-js-v-model-from-dynamci-value%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown