Skip to content

Commit

Permalink
fix(ssr): access window only on client
Browse files Browse the repository at this point in the history
  • Loading branch information
iliyaZelenko committed Sep 18, 2019
1 parent b5f50d4 commit 84c042b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/component.vue
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ export default {
// TODO возможно стоит убрать чтобы не вызывался лишний setSelectedItemByValue
this.setSelectedItemByValue()
},
mounted () {
// listener for window (see removeEventListener on beforeDestroy hook)
this.mousedownListener = window.addEventListener('mousedown', ({ target }) => {
const select = this.$refs['IZ-select']
Expand Down
1 change: 1 addition & 0 deletions src/computed.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default {
return !!this.errorMessage
},
isMobile () {
if (process.server) return false
// return window.innerWidth + window.innerHeight <= 1800
return window.innerWidth <= 900 && window.innerHeight <= 900
},
Expand Down

0 comments on commit 84c042b

Please sign in to comment.