修复resize事件

This commit is contained in:
purocean
2019-08-07 11:28:43 +08:00
parent 747d448395
commit 3de43f552a
3 changed files with 6 additions and 2 deletions
-2
View File
@@ -29,7 +29,6 @@ export default {
}
},
mounted () {
window.addEventListener('resize', this.$refs.editor.resize)
this.$bus.on('resize', this.$refs.editor.resize)
this.$bus.on('editor-insert-value', this.$refs.editor.insert)
this.$bus.on('editor-replace-value', this.$refs.editor.replaceValue)
@@ -38,7 +37,6 @@ export default {
this.restartTimer()
},
beforeDestroy () {
window.removeEventListener('resize', this.$refs.editor.resize)
this.$bus.off('resize', this.$refs.editor.resize)
this.$bus.off('editor-insert-value', this.$refs.editor.insert)
this.$bus.off('editor-replace-value', this.$refs.editor.replaceValue)
+5
View File
@@ -44,18 +44,23 @@ export default {
}
},
mounted () {
window.addEventListener('resize', this.emitResize)
window.document.addEventListener('mousemove', this.resizeFrame)
this.$bus.on('show-toast', this.showToast)
this.$bus.on('toggle-view', this.toggleView)
this.$bus.on('toggle-xterm', this.toggleXterm)
},
beforeDestroy () {
window.removeEventListener('resize', this.emitResize)
window.document.removeEventListener('mousemove', this.resizeFrame)
this.$bus.off('toggle-view', this.toggleView)
this.$bus.off('toggle-xterm', this.toggleXterm)
this.$bus.off('show-toast', this.showToast)
},
methods: {
emitResize () {
this.$bus.emit('resize')
},
showToast (type, content, timeout = 2000) {
// TODO 暂时只有 warn type
this.toast = { type, content }
+1
View File
@@ -146,6 +146,7 @@ export default {
},
methods: {
resizeHandler () {
console.log('xxx')
this.width = this.$refs['view-wrapper'].clientWidth
this.height = this.$refs['view-wrapper'].clientHeight
},