mirror of
https://github.com/zclzone/vue-naive-admin.git
synced 2025-12-26 19:20:21 +08:00
feat: 增加设置主题色功能
This commit is contained in:
25
src/components/common/ThemeSetting.vue
Normal file
25
src/components/common/ThemeSetting.vue
Normal file
@@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<n-tooltip trigger="hover">
|
||||
<template #trigger>
|
||||
<n-color-picker
|
||||
class="mr-16 h-40 w-80"
|
||||
:value="appStore.primaryColor"
|
||||
:swatches="primaryColors"
|
||||
:on-update:value="(v) => appStore.setPrimaryColor(v)"
|
||||
/>
|
||||
</template>
|
||||
设置主题色
|
||||
</n-tooltip>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getPresetColors } from '@arco-design/color'
|
||||
import { useAppStore } from '@/store'
|
||||
const appStore = useAppStore()
|
||||
|
||||
const primaryColors = Object.entries(getPresetColors()).map(([, value]) => value.primary)
|
||||
|
||||
watchEffect(() => {
|
||||
appStore.setThemeColor(appStore.primaryColor, appStore.isDark)
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user