open and close modal
This commit is contained in:
parent
b036decd48
commit
66fa86d944
1 changed files with 54 additions and 6 deletions
|
|
@ -10,19 +10,28 @@
|
||||||
aria-label="Modal window" />
|
aria-label="Modal window" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<contentGroupModal
|
<modal
|
||||||
|
:ref="modalName"
|
||||||
cmsWidgetName="ServiceZipModalWidget"
|
cmsWidgetName="ServiceZipModalWidget"
|
||||||
ref="ServiceZipModalWidget"
|
:onModalOpenedCallback="onModalOpened"
|
||||||
modalId="ServiceZipModalWidget" />
|
:onModalClosedCallback="onModalClosed"
|
||||||
|
:footerButtonText="modalFooterText"
|
||||||
|
@footer-button-event="setZipCode"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import contentGroupModal from "@/iss-components/content-group-modal/content-group-modal.vue";
|
import modal from "@/digital-components/modal/modal.vue"
|
||||||
import textLink from "@/ux-components/text-link/text-link";
|
import textLink from "@/ux-components/text-link/text-link";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "service-zip-modal-question",
|
name: "service-zip-modal-question",
|
||||||
emits: ["update:modalValue"],
|
emits: ["update:modalValue"],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
internalModel: this.copyModel(this.modelValue),
|
||||||
|
};
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
|
@ -39,11 +48,50 @@ export default {
|
||||||
return this.modelValue.serviceZipState + ", " + this.modelValue.serviceZip;
|
return this.modelValue.serviceZipState + ", " + this.modelValue.serviceZip;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
modalFooterText() {
|
||||||
|
return this.getCmsContent(this.modalWidgetName, "FooterText");
|
||||||
|
},
|
||||||
|
modalName() {
|
||||||
|
return this.modalWidgetName;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
copyModel(modelToCopy) {
|
||||||
|
return {
|
||||||
|
serviceZipState: modelToCopy.serviceZipState,
|
||||||
|
serviceZip: modelToCopy.serviceZip,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
openModal() {
|
||||||
|
this.$refs[this.modalName].openModal();
|
||||||
|
},
|
||||||
|
closeModal() {
|
||||||
|
this.$refs[this.modalName].closeModal();
|
||||||
|
},
|
||||||
|
onModalOpened() {
|
||||||
|
this.internalModel.serviceZip = this.modelValue.serviceZip;
|
||||||
|
this.focusOnZipInput();
|
||||||
|
},
|
||||||
|
onModalClosed() {
|
||||||
|
this.internalModel.serviceZip = this.modelValue.serviceZip;
|
||||||
|
this.resetsOnZipInput();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
modelValue(newValue) {
|
||||||
|
this.internalModel = this.copyModel(newValue);
|
||||||
|
},
|
||||||
|
"internalModel.serviceZip": {
|
||||||
|
handler() {
|
||||||
|
this.resetsOnZipInput();
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
contentGroupModal,
|
textLink,
|
||||||
textLink
|
modal
|
||||||
},
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue