-
Notifications
You must be signed in to change notification settings - Fork 392
样式相关优化 #2375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
样式相关优化 #2375
Conversation
…-un-translate-y))
| return { prop, value: values[0].trim() } | ||
| } | ||
|
|
||
| const formatZIndex = ({ prop, value, selector }, { mode }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为啥不走verifyValues来校验实现?
| function calcVisitor ({ key, value, keyPath }: VisitorArg) { | ||
| if (calcUseRegExp.test(value)) { | ||
| // calc translate & border-radius 的百分比计算 | ||
| if (hasOwn(selfPercentRule, key) && /%/.test(value)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
走正则校验严谨一点,声明个内含百分比的正则表达式
| // transform z-index auto to 0 | ||
| transformZIndex(normalStyle) | ||
| if (Array.isArray(normalStyle.transform)) { | ||
| normalStyle.transform = normalStyle.transform.filter(item => !isEmptyObject(item)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为啥要改这个
| }, '') | ||
| } | ||
|
|
||
| function transformZIndex (styleObj: Record<string, any>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
没必要加这个吧,如果这玩意需要运行时校验那要加的可太多了。。。
1.z-index auto 报错编译提示
2.样式编译优化:es6语法+__formatValue简化
3.去掉 translate & border-radius 的百分比计算 & 保留 translateY calc(100% - 20px)的百分比计算
4.去掉非媒体查询场景下的_default&_media字段
5.image 组件Android下保持计算border radius 百分比
回撤改动:
支持transform 分开定义 css var 且包含未定义值的var变量,如 --un-translate-x: -50%;transform translateX(var(--un-translate-x)) translateY(var(--un-translate-y));