feat:增加vant组件库
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { setCookie, getCookie, getLocalStorage, setLocalStorage } from 'vue3-common/utils/storageUtil'
|
||||
import { useDark, useToggle } from '@vueuse/core'
|
||||
import { calcDarken, calcLighten } from '@/utils/element/elColor.ts'
|
||||
|
||||
export const useAppStore = defineStore('ipp', {
|
||||
state: () => ({
|
||||
@@ -89,7 +90,17 @@ export const useAppStore = defineStore('ipp', {
|
||||
return getLocalStorage('theme-color') as string || '#009FA8'
|
||||
},
|
||||
setThemeColor(value: string) {
|
||||
document.documentElement.style.setProperty('--el-color-primary', value)
|
||||
const root = document.documentElement
|
||||
|
||||
root.style.setProperty('--el-color-primary', value)
|
||||
root.style.setProperty('--el-color-primary-light-3', calcLighten(value, 30))
|
||||
root.style.setProperty('--el-color-primary-light-5', calcLighten(value, 50))
|
||||
root.style.setProperty('--el-color-primary-light-7', calcLighten(value, 70))
|
||||
root.style.setProperty('--el-color-primary-light-8', calcLighten(value, 80))
|
||||
root.style.setProperty('--el-color-primary-light-9', calcLighten(value, 90))
|
||||
root.style.setProperty('--el-color-primary-dark-2', calcDarken(value, 20))
|
||||
|
||||
root.style.setProperty('--van-primary-color', value)
|
||||
setLocalStorage('theme-color', value)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user