소스 검색

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' }))
       }
     }
   },