Merge pull request #187 from Safelite/feature/CSR-268_cleanup

changing check change method to take specific value
This commit is contained in:
max-dempsey 2022-02-02 16:38:23 -05:00 committed by GitHub
commit ba9cd0a075
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -108,13 +108,14 @@ export default {
if(Array.isArray(this.answers) && this.answers.length === 1) {
this.modelValueAnswers.push(typeof(this.answers[0]) === 'object' ? this.answers[0].Name : this.answers[0]);
this.$emit("update:modelValue", this.modelValueAnswers);
};
}
},
methods: {
handleCheckedChanged(val) {
// Add or remove item to array of data to emit
val.isChecked ? this.modelValueAnswers.push(val.buttonId) : this.modelValueAnswers.splice(this.modelValueAnswers.indexOf(val.buttonId), 1);
this.$emit("update:modelValue", this.modelValueAnswers.length ? this.modelValueAnswers : undefined);
const answersToEmit = this.modelValueAnswers.length ? this.modelValueAnswers : undefined;
this.$emit("update:modelValue", answersToEmit);
},
},
components: {