56 lines
1.0 KiB
JavaScript
56 lines
1.0 KiB
JavaScript
|
|
import { defineStore } from 'pinia'
|
||
|
|
|
||
|
|
export const useSettingsStore = defineStore('settings', {
|
||
|
|
state: () => ({
|
||
|
|
// 侧边栏状态
|
||
|
|
sidebarCollapsed: false,
|
||
|
|
|
||
|
|
// 界面配置
|
||
|
|
interface: {
|
||
|
|
// 是否显示时间戳
|
||
|
|
showTimestamp: true,
|
||
|
|
// 消息气泡最大宽度(px)
|
||
|
|
messageMaxWidth: 800,
|
||
|
|
// 字体大小(px)
|
||
|
|
fontSize: 14
|
||
|
|
},
|
||
|
|
|
||
|
|
// 主题配置
|
||
|
|
theme: {
|
||
|
|
// 主色调
|
||
|
|
primary: '#07c160',
|
||
|
|
// 背景色
|
||
|
|
background: '#f5f5f5',
|
||
|
|
// 文字颜色
|
||
|
|
textColor: '#333333'
|
||
|
|
}
|
||
|
|
}),
|
||
|
|
|
||
|
|
actions: {
|
||
|
|
// 切换侧边栏状态
|
||
|
|
toggleSidebar() {
|
||
|
|
this.sidebarCollapsed = !this.sidebarCollapsed
|
||
|
|
},
|
||
|
|
|
||
|
|
// 更新界面配置
|
||
|
|
updateInterface(config) {
|
||
|
|
this.interface = {
|
||
|
|
...this.interface,
|
||
|
|
...config
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
// 更新主题配置
|
||
|
|
updateTheme(config) {
|
||
|
|
this.theme = {
|
||
|
|
...this.theme,
|
||
|
|
...config
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
// 重置所有设置
|
||
|
|
resetSettings() {
|
||
|
|
this.$reset()
|
||
|
|
}
|
||
|
|
}
|
||
|
|
})
|