Moving logic for auto-select to replace options question
This commit is contained in:
parent
9c091e91be
commit
588a62c353
2 changed files with 7 additions and 9 deletions
|
|
@ -125,15 +125,6 @@ export default {
|
|||
}
|
||||
},
|
||||
},
|
||||
beforeUpdate(){
|
||||
const exceptions = ["Windshield", "Crack"];
|
||||
const firstItem = typeof(this.answers[0]) === 'object' ? this.answers[0] : this.answers[0];
|
||||
if(Array.isArray(this.answers) && this.answers.length === 1 && !exceptions.includes(typeof(firstItem) === 'object' ? firstItem.Text : firstItem)) {
|
||||
const newSelectedValues = this.selectedValues;
|
||||
newSelectedValues.push(typeof(firstItem) === 'object' ? firstItem.Name : firstItem);
|
||||
this.selectedValues = newSelectedValues;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleCheckedChanged(val) {
|
||||
if(this.isMultiSelect) {
|
||||
|
|
|
|||
|
|
@ -70,6 +70,13 @@ export default ({
|
|||
: [];
|
||||
},
|
||||
},
|
||||
mounted(){
|
||||
if(Array.isArray(this.answersToDisplay) && this.answersToDisplay.length === 1) {
|
||||
const newSelectedValues = this.selectedValues;
|
||||
newSelectedValues.push(this.answersToDisplay[0].Name);
|
||||
this.selectedValues = newSelectedValues;
|
||||
}
|
||||
},
|
||||
components: {
|
||||
buttonQuestion,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue