我正在尝试创建一个表单,供用户选择是否需要进行调查。
<div>Will you need to do a survey</div>
<input type="radio" id="yes" value="true" v-model="salary_form.do_survey">
<label for="yes">Yes</label>
<br>
<input type="radio" id="no" value="false" v-model="salary_form.do_survey">
<label for="no">No</label>
我希望这样,以便当用户选择进行调查时,他们可以选择要进行调查的日期,但是如果他们选择其他方式,则不会显示该选项。
我尝试了以下方法,但似乎仅在单击任何单选按钮时显示该选项。
<div v-if="salary_form.do_survey">
<input type="text">Survey date
</div>
我的Vue代码:
data () {
return {
salary_form: {
salary: '',
maintenance_id: this.maintenance_id,
contractor_salary: 'true',
do_survey: null
}
}
}
我应该怎么做?