Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 36bf6fc1
authored
Apr 12, 2025
by
Netfan
Committed by
GitHub
Apr 12, 2025
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: builtin color change throttled in preference drawer (#5924)
修复偏好设置中的自定义主题色拖动选择颜色时页面会明显卡顿的问题
1 parent
f46ec309
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletions
packages/effects/layouts/src/widgets/preferences/blocks/theme/builtin.vue
packages/effects/layouts/src/widgets/preferences/blocks/theme/builtin.vue
View file @
36bf6fc
...
@@ -9,6 +9,8 @@ import { $t } from '@vben/locales';
...
@@ -9,6 +9,8 @@ import { $t } from '@vben/locales';
import
{
BUILT_IN_THEME_PRESETS
}
from
'@vben/preferences'
;
import
{
BUILT_IN_THEME_PRESETS
}
from
'@vben/preferences'
;
import
{
convertToHsl
,
TinyColor
}
from
'@vben/utils'
;
import
{
convertToHsl
,
TinyColor
}
from
'@vben/utils'
;
import
{
useThrottleFn
}
from
'@vueuse/core'
;
defineOptions
({
defineOptions
({
name
:
'PreferenceBuiltinTheme'
,
name
:
'PreferenceBuiltinTheme'
,
});
});
...
@@ -19,6 +21,15 @@ const colorInput = ref();
...
@@ -19,6 +21,15 @@ const colorInput = ref();
const
modelValue
=
defineModel
<
BuiltinThemeType
>
({
default
:
'default'
});
const
modelValue
=
defineModel
<
BuiltinThemeType
>
({
default
:
'default'
});
const
themeColorPrimary
=
defineModel
<
string
>
(
'themeColorPrimary'
);
const
themeColorPrimary
=
defineModel
<
string
>
(
'themeColorPrimary'
);
const
updateThemeColorPrimary
=
useThrottleFn
(
(
value
:
string
)
=>
{
themeColorPrimary
.
value
=
value
;
},
300
,
true
,
true
,
);
const
inputValue
=
computed
(()
=>
{
const
inputValue
=
computed
(()
=>
{
return
new
TinyColor
(
themeColorPrimary
.
value
||
''
).
toHexString
();
return
new
TinyColor
(
themeColorPrimary
.
value
||
''
).
toHexString
();
});
});
...
@@ -84,7 +95,7 @@ function handleSelect(theme: BuiltinThemePreset) {
...
@@ -84,7 +95,7 @@ function handleSelect(theme: BuiltinThemePreset) {
function
handleInputChange
(
e
:
Event
)
{
function
handleInputChange
(
e
:
Event
)
{
const
target
=
e
.
target
as
HTMLInputElement
;
const
target
=
e
.
target
as
HTMLInputElement
;
themeColorPrimary
.
value
=
convertToHsl
(
target
.
value
);
updateThemeColorPrimary
(
convertToHsl
(
target
.
value
)
);
}
}
function
selectColor
()
{
function
selectColor
()
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment