mirror of
https://github.com/KevinMidboe/vue-js-modal.git
synced 2025-10-29 18:00:20 +00:00
Removed window ref in data, moved init to beforeMount
This commit is contained in:
@@ -147,8 +147,8 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
window: {
|
window: {
|
||||||
width: window.innerWidth,
|
width: 0,
|
||||||
height: window.innerWidth
|
height: 0
|
||||||
},
|
},
|
||||||
|
|
||||||
draggableElement: false
|
draggableElement: false
|
||||||
@@ -178,7 +178,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
beforeMount () {
|
||||||
Modal.event.$on('toggle', (name, state, params) => {
|
Modal.event.$on('toggle', (name, state, params) => {
|
||||||
if (name === this.name) {
|
if (name === this.name) {
|
||||||
if (typeof state === 'undefined') {
|
if (typeof state === 'undefined') {
|
||||||
@@ -190,13 +190,11 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener('resize', this.onWindowResize)
|
window.addEventListener('resize', this.onWindowResize)
|
||||||
|
this.onWindowResize()
|
||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
window.removeEventListener('resize', this.onWindowResize)
|
window.removeEventListener('resize', this.onWindowResize)
|
||||||
},
|
},
|
||||||
beforeMount () {
|
|
||||||
this.onWindowResize()
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
position () {
|
position () {
|
||||||
const { window, modal, shift } = this
|
const { window, modal, shift } = this
|
||||||
|
|||||||
Reference in New Issue
Block a user