浏览代码

fix: 在游戏结束时先发送socket更新页面再显示结束弹窗

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

+ 1 - 1
src/components/Game.vue

@@ -40,12 +40,12 @@ export default {
   watch: {
     winner(val) {
       if (val) {
+        this.ws.send(JSON.stringify({ code: this.code, status: 'over' }))
         if (val === 'unknow') {
           alert('game over!')
         } else {
           alert(`${val} is winner!`)
         }
-        this.ws.send(JSON.stringify({ code: this.code, status: 'over' }))
       }
     }
   },