File tree 1 file changed +12
-1
lines changed
packages/effects/layouts/src/widgets/preferences/blocks/theme
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ import { $t } from '@vben/locales';
9
9
import { BUILT_IN_THEME_PRESETS } from ' @vben/preferences' ;
10
10
import { convertToHsl , TinyColor } from ' @vben/utils' ;
11
11
12
+ import { useThrottleFn } from ' @vueuse/core' ;
13
+
12
14
defineOptions ({
13
15
name: ' PreferenceBuiltinTheme' ,
14
16
});
@@ -19,6 +21,15 @@ const colorInput = ref();
19
21
const modelValue = defineModel <BuiltinThemeType >({ default: ' default' });
20
22
const themeColorPrimary = defineModel <string >(' themeColorPrimary' );
21
23
24
+ const updateThemeColorPrimary = useThrottleFn (
25
+ (value : string ) => {
26
+ themeColorPrimary .value = value ;
27
+ },
28
+ 300 ,
29
+ true ,
30
+ true ,
31
+ );
32
+
22
33
const inputValue = computed (() => {
23
34
return new TinyColor (themeColorPrimary .value || ' ' ).toHexString ();
24
35
});
@@ -84,7 +95,7 @@ function handleSelect(theme: BuiltinThemePreset) {
84
95
85
96
function handleInputChange(e : Event ) {
86
97
const target = e .target as HTMLInputElement ;
87
- themeColorPrimary . value = convertToHsl (target .value );
98
+ updateThemeColorPrimary ( convertToHsl (target .value ) );
88
99
}
89
100
90
101
function selectColor() {
You can’t perform that action at this time.
0 commit comments