Skip to content

Commit ab0c915

Browse files
committed
fix: 🐛 修复主题
1 parent bb20e21 commit ab0c915

File tree

5 files changed

+98
-7
lines changed

5 files changed

+98
-7
lines changed

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default [
2222
},
2323
{
2424
languageOptions: {
25+
ecmaVersion: '2022',
2526
globals: {
2627
...globals.browser,
2728
...globals.node

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
"lint": "oxlint && eslint",
1111
"lint:fix": "oxlint --fix && eslint --fix",
1212
"preinstall": "npx only-allow pnpm",
13-
"prepare": "husky init",
13+
"prepare": "husky",
1414
"cz": "git-cz"
1515
},
1616
"dependencies": {
17+
"@primevue/core": "^4.2.5",
1718
"@primevue/themes": "^4.2.1",
1819
"@vueuse/core": "^11.2.0",
1920
"animate.css": "^4.1.1",
@@ -27,6 +28,7 @@
2728
"lodash-es": "^4.17.21",
2829
"mitt": "^3.0.1",
2930
"pinia": "^2.2.6",
31+
"primeicons": "^7.0.0",
3032
"primevue": "^4.2.1",
3133
"swiper": "^11.1.14",
3234
"uuid": "^11.0.2",

pnpm-lock.yaml

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createApp } from 'vue'
33
import App from './App.vue'
44
import directives from './directives'
55
import PrimeVue from 'primevue/config'
6-
import Nora from '@primevue/themes/nora'
6+
import Preset from '@/themes/app-theme'
77
import { i18n } from '@/locales'
88
import { setupStore } from '@/stores'
99
import { setupRouter, router } from './router'
@@ -12,18 +12,15 @@ import { urlParamsLogin } from './router/helper'
1212
import './assets/main.css'
1313
import 'virtual:uno.css'
1414
import 'animate.css'
15+
import 'primeicons/primeicons.css'
1516
import '@/assets/scss/reset.scss'
1617
import '@/assets/scss/adapter.scss'
1718
import '@/assets/scss/theme.scss'
1819

1920
async function bootstrap() {
2021
const app = createApp(App)
2122

22-
app.use(PrimeVue, {
23-
theme: {
24-
preset: Nora
25-
}
26-
})
23+
app.use(PrimeVue, { theme: Preset, ripple: true })
2724
app.use(directives)
2825
app.use(i18n)
2926

src/themes/app-theme.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { definePreset } from '@primevue/themes'
2+
import Aura from '@primevue/themes/aura'
3+
4+
export const NoirPreset = definePreset(Aura, {
5+
semantic: {
6+
primary: {
7+
50: '{blue.50}',
8+
100: '{blue.100}',
9+
200: '{blue.200}',
10+
300: '{blue.300}',
11+
400: '{blue.400}',
12+
500: '{blue.500}',
13+
600: '{blue.600}',
14+
700: '{blue.700}',
15+
800: '{blue.800}',
16+
900: '{blue.900}',
17+
950: '{blue.950}'
18+
},
19+
colorScheme: {
20+
light: {
21+
primary: {
22+
color: '{blue.950}',
23+
contrastColor: '#ffffff',
24+
hoverColor: '{blue.800}',
25+
activeColor: '{blue.700}'
26+
},
27+
28+
highlight: {
29+
background: '{blue.950}',
30+
focusBackground: '{blue.700}',
31+
color: '#ffffff',
32+
focusColor: '#ffffff'
33+
},
34+
},
35+
dark: {
36+
primary: {
37+
color: '{primary.50}',
38+
contrastColor: '{primary.950}',
39+
hoverColor: '{primary.200}',
40+
activeColor: '{primary.300}'
41+
},
42+
highlight: {
43+
background: '{primary.50}',
44+
focusBackground: '{primary.300}',
45+
color: '{primary.950}',
46+
focusColor: '{primary.950}'
47+
}
48+
}
49+
}
50+
}
51+
})
52+
53+
export default {
54+
preset: NoirPreset,
55+
options: {
56+
darkModeSelector: '.dark'
57+
}
58+
}

0 commit comments

Comments
 (0)