feat: 添加系统设置

This commit is contained in:
郝先瑞
2022-02-20 23:55:14 +08:00
parent 9aad4827ed
commit e562386c6e
3 changed files with 9 additions and 8 deletions

View File

@@ -1,13 +1,12 @@
import { defineStore } from "pinia";
import { store } from "@/store";
import {defineStore} from "pinia";
import {store} from "@/store";
import {SettingState} from "@/store/interface";
import defaultSettings from '../../settings'
const {showSettings, tagsView, fixedHeader, sidebarLogo} = defaultSettings
export const useSettingStore = defineStore({
id: "setting",
state:():SettingState =>({
state: (): SettingState => ({
theme: '',
showSettings: showSettings,
tagsView: tagsView,
@@ -15,11 +14,11 @@ export const useSettingStore = defineStore({
sidebarLogo: sidebarLogo,
}),
actions: {
async changeSetting( payload: { key: string, value: any }){
async changeSetting(payload: { key: string, value: any }) {
const {key, value} = payload
switch (key) {
case 'theme':
this.theme = value
this.theme = value
break
case 'showSettings':
this.showSettings = value