2024-05-23 18:04:40 +08:00
|
|
|
import { ref } from 'vue'
|
|
|
|
import { defineStore } from 'pinia'
|
2024-05-22 15:42:13 +08:00
|
|
|
|
|
|
|
const useSysStore = defineStore(
|
2024-05-23 18:04:40 +08:00
|
|
|
'sys',
|
|
|
|
() => {
|
|
|
|
const theme = ref('')
|
|
|
|
const mode = ref('light')
|
|
|
|
const modeAuto = ref(false)
|
|
|
|
const fontSize = ref(1)
|
2024-05-22 15:42:13 +08:00
|
|
|
|
2024-05-23 18:04:40 +08:00
|
|
|
function setTheme(stheme = '') {
|
|
|
|
console.log('setTheme', stheme)
|
|
|
|
theme.value = stheme ? stheme : 'orange'
|
|
|
|
}
|
2024-05-22 15:42:13 +08:00
|
|
|
|
2024-05-23 18:04:40 +08:00
|
|
|
return {
|
|
|
|
theme,
|
|
|
|
mode,
|
|
|
|
modeAuto,
|
|
|
|
fontSize,
|
|
|
|
setTheme,
|
|
|
|
}
|
2024-05-22 15:42:13 +08:00
|
|
|
},
|
2024-05-23 18:04:40 +08:00
|
|
|
{
|
|
|
|
persist: {
|
|
|
|
enabled: true,
|
|
|
|
strategies: [{ key: 'sys-store' }],
|
|
|
|
},
|
|
|
|
}
|
|
|
|
)
|
2024-05-22 15:42:13 +08:00
|
|
|
|
2024-05-23 18:04:40 +08:00
|
|
|
export default useSysStore
|