fix(color-picker): 修复color-picker的 "预设颜色和最近使用颜色" 功能 对部分值无法正确格式化的问题 - #3589
Open
NullIsObject wants to merge 1 commit into
Open
fix(color-picker): 修复color-picker的 "预设颜色和最近使用颜色" 功能 对部分值无法正确格式化的问题#3589NullIsObject wants to merge 1 commit into
NullIsObject wants to merge 1 commit into
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Types of changes
Background and context
color-picker 提供了history-colors 和 preset-colors两个props。当传入的值为rgb或者带不透明度的16进制值时,如果用户选择这部分颜色,组件的rgb值为红色,而不透明度不会变化
Solution
在packages/web-vue/components/color-picker/panel.tsx中,修改了onHexInputChange方法的格式化颜色的代码,保证颜色的正常格式化,同时,额外调用onAlphaChange触发不透明度的更新
How is the change tested?
为history-colors 或者 preset-colors传入带有不透明度的16进制颜色值,或者rgb值,并在界面上选择这部分颜色即可复现。官网有提供"预设颜色和历史颜色"的示例,可以选择一个带不透明度的颜色值以将其添加到历史,再从历史中选中
Changelog
Checklist:
npm run test)featurebranch and othersshould be submitted to
mainbranch)Other information