mirror of
https://github.com/purocean/yn.git
synced 2026-09-24 15:46:02 +08:00
修复resize事件
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -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
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user