diff --git a/src/vue/base.ts b/src/vue/base.ts index 455cd0d738..522b0432d3 100644 --- a/src/vue/base.ts +++ b/src/vue/base.ts @@ -19,8 +19,10 @@ export class BaseVue extends Vue { } protected onMounted() { } protected onUpdated() { } + protected onBeforeUpdated() {} protected onDestroyed() { } - protected onCreated() { + protected onCreated() {} + created() { var model = this.getModel(); if (!model) return; model.iteratePropertiesHash((propertiesHash: any, name: any) => { @@ -41,8 +43,6 @@ export class BaseVue extends Vue { Vue.set(propertiesHash, name, val); else propertiesHash[name] = val; }; - } - created() { this.onCreated(); } beforeMount() { @@ -50,6 +50,7 @@ export class BaseVue extends Vue { } beforeUpdate() { this.setIsRendering(true); + this.onBeforeUpdated(); } mounted() { this.setIsRendering(false); diff --git a/src/vue/components/dropdown/dropdown.vue b/src/vue/components/dropdown/dropdown.vue index 00205842d4..76541c16ab 100644 --- a/src/vue/components/dropdown/dropdown.vue +++ b/src/vue/components/dropdown/dropdown.vue @@ -130,14 +130,8 @@ export class DropdownComponent extends BaseVue { inputChange(event: any) { this.model.inputStringRendered = event.target.value; } - - public get showSelectedItemLocText() { - return this.question.showSelectedItemLocText; - } - - public get selectedItemLocText() { - return this.question.selectedItemLocText; - } + showSelectedItemLocText: any = null; + selectedItemLocText: any = false; public click(event: any) { this.model?.onClick(event); @@ -175,8 +169,17 @@ export class DropdownComponent extends BaseVue { } } } + private updateSelectedItemProperties() { + this.showSelectedItemLocText = this.question.showSelectedItemLocText; + this.selectedItemLocText = this.question.selectedItemLocText; + } + onCreated(): void { + this.updateSelectedItemProperties(); + } + onBeforeUpdated(): void { + this.updateSelectedItemProperties(); + } } - Vue.component("sv-dropdown", DropdownComponent); export default DropdownComponent;