未验证 提交 32ed5ac1 编写于 作者: 郝先瑞 提交者: Gitee

!3 利用vueuse做主题持久化存储和elementPlus主题色切换

Merge pull request !3 from 小小大石头/master
......@@ -2,15 +2,13 @@ import { defineStore } from 'pinia';
import defaultSettings from '../../settings';
import { localStorage } from '@/utils/localStorage';
import { ref } from 'vue';
import { useCssVar, useStorage } from '@vueuse/core';
const el = document.documentElement;
export const useSettingsStore = defineStore('setting', () => {
// state
const theme = ref(
localStorage.get('theme') ||
getComputedStyle(el).getPropertyValue(`--el-color-primary`)
);
const theme = useStorage('theme', useCssVar('--el-color-primary', el))
const showSettings = ref<boolean>(defaultSettings.showSettings);
const tagsView = ref<boolean>(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册