Skip to content

Commit 9133761

Browse files
committed
feat: support config the scss variables
1 parent 4d535e9 commit 9133761

File tree

11 files changed

+261
-48
lines changed

11 files changed

+261
-48
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,27 @@ Whether to cache the element-plus components and directives. **Only effective in
121121

122122
If you enable this feature, you will get faster loading speed in development mode.
123123

124+
### themeChalk
125+
126+
- Type: `object`
127+
128+
Configure SCSS variables for generating custom themes. **Only effective when `importStyle` is `scss`**.
129+
130+
e.g.
131+
132+
```ts
133+
{
134+
$colors: {
135+
primary: { base: 'rgba(107,33,168, 1)' }
136+
},
137+
dark: {
138+
$colors: {
139+
primary: { base: 'rgb(242, 216, 22)' }
140+
}
141+
}
142+
}
143+
```
144+
124145
### globalConfig
125146

126147
- Type: `object`

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"eslint": "^8.57.1",
5757
"nuxi": "^3.15.0",
5858
"nuxt": "^3.13.2",
59+
"sass": "^1.89.2",
5960
"typescript": "^5.6.3",
6061
"vue": "^3.5.12"
6162
}

playground/app.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function changeTheme () {
4343
</script>
4444

4545
<template>
46-
<el-config-provider>
46+
<el-config-provider namespace="ep">
4747
<el-container>
4848
<el-header>
4949
<header-menu />

playground/nuxt.config.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,33 @@ export default defineNuxtConfig({
66
compatibilityDate: '2024-07-05',
77
modules: [ElementPlus],
88
elementPlus: {
9+
cache: true,
10+
importStyle: 'scss',
911
defaultLocale: 'zh-cn',
1012
imports: [
1113
['useLocale', 'es/hooks/use-locale/index.mjs']
1214
],
1315
themes: ['dark'],
16+
namespace: 'ep',
1417
injectionID: { prefix: 100, current: 1 },
15-
globalConfig: { size: 'small', zIndex: 1000 }
18+
globalConfig: { size: 'small', zIndex: 1000, namespace: 'ep' },
19+
themeChalk: {
20+
$colors: {
21+
primary: { base: 'rgba(107,33,168, 1)' },
22+
success: { base: 'green' },
23+
warning: { base: '#f9a23c' },
24+
danger: { base: '#ff3300' },
25+
error: { base: '#f56c6c' }
26+
},
27+
dark: {
28+
$colors: {
29+
primary: { base: 'rgb(242, 216, 22)' }
30+
},
31+
'$bg-color': {
32+
page: '#0a0a0a',
33+
overlay: '#1d1e1f'
34+
}
35+
}
36+
}
1637
}
1738
})

0 commit comments

Comments
 (0)