增加设置板块, 允许自定义界面设置, 使用 VueUse 存储
All checks were successful
Build / build-and-test (push) Successful in 27s
All checks were successful
Build / build-and-test (push) Successful in 27s
[Style] 为主视图增加 16px 间距 更新 mdui-card 的右边距问题 (老问题了, 还是没有解决) [Base] 引入 VueUse 分离 Axios HTML 部分紧凑化
This commit is contained in:
28
src/stores/appSetting.js
Normal file
28
src/stores/appSetting.js
Normal file
@ -0,0 +1,28 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { reactive } from 'vue'
|
||||
import { useStorage, watchWithFilter, debounceFilter } from '@vueuse/core'
|
||||
|
||||
const CURRENT_VERSION = 1
|
||||
|
||||
const DEFAULT_SETTINGS = {
|
||||
version: CURRENT_VERSION,
|
||||
darkTheme: false,
|
||||
autoTheme: true,
|
||||
colorScheme: '#890000'
|
||||
}
|
||||
|
||||
export const useAppSettingStore = defineStore('appSetting', () => {
|
||||
const stored = useStorage('app-settings', DEFAULT_SETTINGS)
|
||||
if (stored.version !== CURRENT_VERSION) {
|
||||
Object.assign(stored, DEFAULT_SETTINGS)
|
||||
}
|
||||
function resetSettings() {
|
||||
Object.assign(stored, DEFAULT_SETTINGS)
|
||||
}
|
||||
return {
|
||||
value: stored,
|
||||
resetSettings,
|
||||
}
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user