fix: 代码审查问题修复 — socket 代理提供 + inject 空安全 + 观战人数响应式

This commit is contained in:
2026-06-23 11:28:27 +08:00
parent cf1a14bf24
commit f937b5cdb3
6 changed files with 54 additions and 21 deletions

View File

@@ -8,22 +8,11 @@
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { storeToRefs } from 'pinia'
import { useRoomStore } from '@/stores'
import { storeToRefs } from 'pinia'
const store = useRoomStore()
const { players } = storeToRefs(store)
/**
* 观战人数估算WS 连接数 - 玩家数
* 后续由 WS spectator_join/leave 事件维护更准确的数据
*/
const spectatorCount = computed(() => {
// 首期简化处理:后端 spectator 数据通过 WS 事件维护
// 这里暂时返回固定值,后续通过 Store 中的 spectators 列表计算
return 0
})
const { spectatorCount } = storeToRefs(store)
</script>
<style scoped lang="scss">