浏览代码

窗口变化

zhusiqing 5 年之前
父节点
当前提交
a69a5e1ff9
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/components/Game.vue

+ 4 - 0
src/components/Game.vue

@@ -36,6 +36,10 @@ export default {
   mounted() {
     const sumHeight = window.innerHeight
     this.height = `${Math.floor(sumHeight / 5)}px`
+    window.addEventListener('resize', () => {
+      const sumHeight = window.innerHeight
+      this.height = `${Math.floor(sumHeight / 5)}px`
+    })
   },
   beforeDestroy() {
     this.ws.close()