From 620d905e29040436e6f1b0147a0ad8e9b2a7b198 Mon Sep 17 00:00:00 2001 From: euvl Date: Mon, 19 Jun 2017 22:23:53 +0100 Subject: [PATCH] Removed window ref in data, moved init to beforeMount --- src/Modal.vue | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Modal.vue b/src/Modal.vue index b4cc37d..2be421c 100644 --- a/src/Modal.vue +++ b/src/Modal.vue @@ -147,8 +147,8 @@ }, window: { - width: window.innerWidth, - height: window.innerWidth + width: 0, + height: 0 }, draggableElement: false @@ -178,7 +178,7 @@ } } }, - created () { + beforeMount () { Modal.event.$on('toggle', (name, state, params) => { if (name === this.name) { if (typeof state === 'undefined') { @@ -190,13 +190,11 @@ }); window.addEventListener('resize', this.onWindowResize) + this.onWindowResize() }, beforeDestroy () { window.removeEventListener('resize', this.onWindowResize) }, - beforeMount () { - this.onWindowResize() - }, computed: { position () { const { window, modal, shift } = this