DigitalConsumer.FixMyGlass/src/mixins/input-button-wrapper-mixin.js
2022-09-22 14:23:26 -04:00

39 lines
964 B
JavaScript

export default {
props: {
modelValue: [Array, String, Number],
value: [String, Number],
isMultiSelect: Boolean,
groupName: String,
buttonLabel: [Number, String],
buttonLabelSubCopy: String,
buttonImage: String,
altText: String,
textPosition: String,
screenReaderOnlyText: String,
valueToLogType: String,
validationRules: String,
isWide: Boolean
},
data() {
return {
selectedValue: null,
};
},
mounted() {
this.selectedValue = this.modelValue;
},
methods: {
handleAnswerChange(e) {
if (this.preHandleAnswerChange) {
this.preHandleAnswerChange(e)
}
this.$emit("change", e);
},
},
watch: {
selectedValue(selectedValue) {
this.$emit("update:modelValue", selectedValue);
},
},
};