Answer the question
In order to leave comments, you need to log in
How to draw a block if the radio button is pressed?
For the questionnaire, there is a component with a template, there is a block with the answer and there is a block with an additional field for the comment to the answer. It is necessary that by default the block for the comment is not shown, but gets out only when the radio button with the answer is selected.
Answer the question
In order to leave comments, you need to log in
<div id="app">
<input type="radio" id="one" value="Один" v-model="picked">
<label for="one">Один</label>
<br>
<input type="radio" id="two" value="Два" v-model="picked">
<label for="two">Два</label>
<br>
<span>Выбрано: {{ picked }}</span><br>
<input type="text" v-if="showComment">
</div>
const vm = new Vue({
el: "#app",
data: {
picked : '',
showComment: false
},
watch: {
picked (){
this.showComment = (this.picked == 'Два');
}
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question