63 lines
1.5 KiB
Vue
63 lines
1.5 KiB
Vue
<template>
|
|
<buttonQuestion
|
|
class="radioQuestion"
|
|
isOverflowScrollable
|
|
selectingInitiatesLoad
|
|
:questionText="questionText"
|
|
:answers="makes"
|
|
groupName="ChooseVehicleMake"
|
|
textPosition="text-start"
|
|
v-model="selectedValueAsArray"
|
|
isRequired=true
|
|
/>
|
|
</template>
|
|
|
|
<script>
|
|
import buttonQuestion from "@/common-components/button-question/button-question";
|
|
// Supporting files
|
|
import store from "@/store";
|
|
import { storeActions } from "@/constants/store-actions.js";
|
|
import baseMixin from "@/mixins/base-mixin.js";
|
|
|
|
export default {
|
|
name: "make-question",
|
|
data() {
|
|
return {
|
|
makes: Array,
|
|
};
|
|
},
|
|
props: {
|
|
modelValue: String,
|
|
cmsWidgetName: String,
|
|
},
|
|
computed: {
|
|
questionText(){
|
|
return this.getCmsContent(this.cmsWidgetName, 'QuestionText');
|
|
},
|
|
selectedValueAsArray: {
|
|
get: function() {
|
|
const modelValueAsArray = this.modelValue ? [this.modelValue] : [];
|
|
return modelValueAsArray;
|
|
},
|
|
set: function(newValue) {
|
|
const newValueAsScalar = newValue && newValue.length > 0 ? newValue[0] : null;
|
|
this.$emit("update:modelValue", newValueAsScalar);
|
|
}
|
|
}
|
|
},
|
|
components: {
|
|
buttonQuestion,
|
|
},
|
|
methods: {
|
|
loadInitialData() {
|
|
return baseMixin.methods.dispatchStoreAction(
|
|
storeActions.GET_VEHICLE_MAKES,
|
|
{ year: store.getters.vehicle.year }
|
|
);
|
|
},
|
|
initializeComponent(initialData) {
|
|
this.makes = initialData;
|
|
},
|
|
},
|
|
};
|
|
</script>
|