fix: 代码审查问题修复 — socket 代理提供 + inject 空安全 + 观战人数响应式
This commit is contained in:
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user