feat: 数据mock

This commit is contained in:
2026-06-22 09:28:15 +08:00
parent 676f4d5e2d
commit 0b7a89c06b
10 changed files with 613 additions and 73 deletions
+6 -1
View File
@@ -1,5 +1,6 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
import type { GameConfig } from '@/api/modules/game'
/** 侧边栏最小宽度 */
export const MIN_SIDEBAR_WIDTH = 200
@@ -19,6 +20,8 @@ export const useBaseLayoutStore = defineStore(
const activeGameIcon = ref<string>('🐍')
/** 当前选中的游戏名称 */
const activeGameName = ref<string>('贪吃蛇')
/** 当前选中游戏的配置(模式、底注、人数等选项) */
const activeGameConfig = ref<GameConfig | null>(null)
/** 侧边栏当前宽度 */
const sidebarWidth = ref<number>(DEFAULT_SIDEBAR_WIDTH)
@@ -36,10 +39,11 @@ export const useBaseLayoutStore = defineStore(
* @param icon - 游戏图标
* @param name - 游戏名称
*/
const setActiveGame = (id: string, icon: string, name: string): void => {
const setActiveGame = (id: string, icon: string, name: string, config: GameConfig): void => {
activeGameId.value = id
activeGameIcon.value = icon
activeGameName.value = name
activeGameConfig.value = config
}
/**
@@ -55,6 +59,7 @@ export const useBaseLayoutStore = defineStore(
activeGameId,
activeGameIcon,
activeGameName,
activeGameConfig,
sidebarWidth,
setTopbarTitle,
setActiveGame,