I am encountering a tricky issue in my Vuejs/Nuxtjs
application. In the application, I am creating multiple Nodes
dynamically. These Nodes
have the Radio button
for which I have assigned a v-model
. However, when I change the value of one Vuejs v-model
is affecting all other Node
Values.
I am aware that this issue is happening because of the same v-model
being used for all Nodes
. I would like to assign a different V-model
to my Radio button
but I want to do it without using the v-for
.
I have created the sample code in the CodeSandbox
Steps to reproduce:
- Drag and drop the
Identifiers
into the canvas. Now theURN
will be selected. - Now Drag and drop another
Identifiers
into the canvas. Now the firstIdentifiers Node: URN
will disappear. I am unable to handle eachNode value
independently.
The problem is arising in the file @components/IdentifiersNode.vue
and in the radio button.
Code sample based on the Kissu response :
<input
id="identifierTypeURN"
:data="identifierSyntax"
value="URN"
type="radio"
name="instanceIdentifierURN"
@input="instanceIdentifiersSyntaxChange('URN')"
>
<label for="identifierTypeURN">URN</label>
<input
id="identifierTypeWebURI"
:data="identifierSyntax"
value="WebURI"
type="radio"
name="instanceIdentifierWebURI"
@input="instanceIdentifiersSyntaxChange('WebURI')"
>
<label for="identifierTypeWebURI">WebURI</label>
Can someone please check and let me know what am I doing wrong here: https://codesandbox.io/s/cocky-matan-kvqnu?file=/nuxt.config.js
:data
and@input
rather thanv-model
, will be simpler.@input
and made the respective change but I did not understand the:data
part. I tried to removev-model
and added:data
but that does not seem to work. Can you please provide some reference related to:data
forinput type radio
? I have added a code sample in the above question for your reference.data
is mainly a prop here, the name is a placeholder. Replace it with what you're using as your state. Also, you may needmodel
depending on the type of event sent by a radio button. It's always a bit tricky to check those low level HTML things.customized component
? And then use that custom component within myIdentifiersNode.vue
?