2023-05-12 18:23:22 +00:00
|
|
|
// KUNGalgame 设置面板的 store
|
|
|
|
import { ref } from 'vue'
|
|
|
|
import { defineStore } from 'pinia'
|
2023-05-26 09:07:35 +00:00
|
|
|
|
|
|
|
// 设置面板配置
|
|
|
|
interface KUNGalgameSettings {
|
|
|
|
// 是否显示设置面板
|
|
|
|
settings: boolean
|
|
|
|
// 主页宽度
|
|
|
|
mainPageWidth: string
|
|
|
|
}
|
|
|
|
|
|
|
|
// 读出 localStorage 中主页的宽度数据
|
|
|
|
const loadMainPageWidth =
|
|
|
|
(localStorage.getItem('KUNGalgame-main-page-width') as string) || '61.8%'
|
|
|
|
|
|
|
|
const kungalgameSettings: KUNGalgameSettings = {
|
|
|
|
// false -> settings panel off, true -> settings panel on
|
|
|
|
settings: false,
|
|
|
|
mainPageWidth: loadMainPageWidth,
|
|
|
|
}
|
2023-05-12 18:23:22 +00:00
|
|
|
|
|
|
|
export const useSettingsPanelStore = defineStore('settings', () => {
|
2023-05-14 07:16:28 +00:00
|
|
|
const showSettings = ref<boolean>(kungalgameSettings.settings)
|
2023-05-26 09:07:35 +00:00
|
|
|
const showMainPageWidth = ref<string>(kungalgameSettings.mainPageWidth)
|
2023-05-12 18:23:22 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
showSettings,
|
2023-05-26 09:07:35 +00:00
|
|
|
showMainPageWidth,
|
2023-05-12 18:23:22 +00:00
|
|
|
}
|
|
|
|
})
|