我正试着用单选按钮来显示下列组件
<template>
<form id="contactForm" @submit="sendMessage()">
<v-radio-group row :mandatory="false" :model="gender" data-vv-name="gender" v-validate="'required'" name="gender">
<v-radio @click='changeGender("f")' :label='genderLabel("f")' :value="f"></v-radio>
<v-radio @click='changeGender("m")' :label='genderLabel("m")' :value="m"></v-radio>
</v-radio-group>
...
</form>
</template>
<script>
export default {
name: "contactForm",
data() {
return {
gender: "f"
};
},
...
methods: {
...
changeGender: function(value) {
console.log("gender changed to: ", value);
this.gender = value;
}
...
</script>
const radioInput = wrapper.findAll('input[type="radio"]');
radioInput.at(1).setChecked(); // input element value is changed, v-model is not
radioInput.at(1).trigger('click') // v-model updated
但我有个错误。。。单击第二个单选按钮[]不会更改值。。
感谢您的反馈