We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 0b4c352 + 664854f commit ea60cc0Copy full SHA for ea60cc0
src/mixins/window_size.js
@@ -5,20 +5,23 @@ export default {
5
windowWidth: 0
6
}
7
},
8
-
9
created () {
10
window.addEventListener('resize', this.getWindowSize)
11
this.getWindowSize()
12
13
+ mounted () {
+ this.getWindowSize()
14
+ },
15
beforeDestroy () {
16
window.removeEventListener('resize', this.getWindowSize)
17
18
19
methods: {
20
getWindowSize () {
- this.windowHeight = window.innerHeight
21
- this.windowWidth = window.innerWidth
+ if (this.$el) {
22
+ this.windowHeight = this.$el.clientHeight
23
+ this.windowWidth = this.$el.clientWidth
24
+ }
25
26
27
0 commit comments