|
1 | 1 | --- |
2 | 2 | import { beautifyConfig } from "@/config"; |
3 | 3 |
|
4 | | -const { enable, field, titlePrefixIcon, titlePrefixIconColor, animation, hover, colors, sizes } = beautifyConfig; |
| 4 | +const { |
| 5 | + enable, |
| 6 | + field, |
| 7 | + titlePrefixIcon, |
| 8 | + titlePrefixIconColor, |
| 9 | + animation, |
| 10 | + hover, |
| 11 | + colors, |
| 12 | + sizes, |
| 13 | +} = beautifyConfig; |
5 | 14 |
|
6 | 15 | // 根据配置生成CSS变量 |
7 | 16 | const cssVars = { |
8 | | - '--title-icon': `"${titlePrefixIcon}"`, |
9 | | - '--title-icon-color': titlePrefixIconColor, |
10 | | - '--animation-speed': (animation?.enable && animation?.rotate) ? `${animation.speed}s` : '0s', |
11 | | - '--animation-direction': animation?.direction === 'clockwise' ? '360deg' : '-360deg', |
12 | | - '--hover-speed': (hover?.enable && animation?.rotate) ? `${hover.slowSpeed}s` : '0s', |
13 | | - '--hover-color': hover?.color || titlePrefixIconColor, |
14 | | - '--h1-color': colors?.h1 || titlePrefixIconColor, |
15 | | - '--h2-color': colors?.h2 || titlePrefixIconColor, |
16 | | - '--h3-color': colors?.h3 || titlePrefixIconColor, |
17 | | - '--h4-color': colors?.h4 || titlePrefixIconColor, |
18 | | - '--h5-color': colors?.h5 || titlePrefixIconColor, |
19 | | - '--h6-color': colors?.h6 || titlePrefixIconColor, |
20 | | - '--h1-size': sizes?.h1 || '1.3rem', |
21 | | - '--h2-size': sizes?.h2 || '1.1rem', |
22 | | - '--h3-size': sizes?.h3 || '0.95rem', |
23 | | - '--h4-size': sizes?.h4 || '0.8rem', |
24 | | - '--h5-size': sizes?.h5 || '0.7rem', |
25 | | - '--h6-size': sizes?.h6 || '0.66rem', |
| 17 | + "--title-icon": `"${titlePrefixIcon}"`, |
| 18 | + "--title-icon-color": titlePrefixIconColor, |
| 19 | + "--animation-speed": |
| 20 | + animation?.enable && animation?.rotate ? `${animation.speed}s` : "0s", |
| 21 | + "--animation-direction": |
| 22 | + animation?.direction === "clockwise" ? "360deg" : "-360deg", |
| 23 | + "--hover-speed": |
| 24 | + hover?.enable && animation?.rotate ? `${hover.slowSpeed}s` : "0s", |
| 25 | + "--hover-color": hover?.color || titlePrefixIconColor, |
| 26 | + "--h1-color": colors?.h1 || titlePrefixIconColor, |
| 27 | + "--h2-color": colors?.h2 || titlePrefixIconColor, |
| 28 | + "--h3-color": colors?.h3 || titlePrefixIconColor, |
| 29 | + "--h4-color": colors?.h4 || titlePrefixIconColor, |
| 30 | + "--h5-color": colors?.h5 || titlePrefixIconColor, |
| 31 | + "--h6-color": colors?.h6 || titlePrefixIconColor, |
| 32 | + "--h1-size": sizes?.h1 || "1.3rem", |
| 33 | + "--h2-size": sizes?.h2 || "1.1rem", |
| 34 | + "--h3-size": sizes?.h3 || "0.95rem", |
| 35 | + "--h4-size": sizes?.h4 || "0.8rem", |
| 36 | + "--h5-size": sizes?.h5 || "0.7rem", |
| 37 | + "--h6-size": sizes?.h6 || "0.66rem", |
26 | 38 | }; |
27 | 39 | --- |
28 | 40 |
|
|
0 commit comments