-
Notifications
You must be signed in to change notification settings - Fork 393
样式相关优化 #2355
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?
样式相关优化 #2355
Conversation
| needStringify = false | ||
| } else { | ||
| value = `global.__formatValue(${+matched[1]}, '${matched[2]}')` | ||
| value = `${formatValueName || 'global.__formatValue'}(${+matched[1]}, '${matched[2]}')` |
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.
|| 'global.__formatValue' 不用加这个兜底了
| const classMapCode = Object.entries(classMap).reduce((result, [key, value]) => { | ||
| result !== '' && (result += ',') | ||
| result += `${isValidIdentifierStr(key) ? `${key}` : `['${key}']`}: () => (${shallowStringify(value)})` | ||
| result += `${isValidIdentifierStr(key) ? `${key}` : `['${key}']`}: function(_f){return ${shallowStringify(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.
定义一个常量formatValueName,这个地方也读取这个常量:function(${formatValueName})
| global.__GCC = function (className, classMap, classMapValueCache) { | ||
| if (!classMapValueCache.has(className)) { | ||
| const styleObj = classMap[className]?.() | ||
| const _f = global.__formatValue |
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.
这里行没有意义
| global.__mpxSizeCount = 0 | ||
| global.__mpxPageSizeCountMap = reactive({}) | ||
|
|
||
| global.__GCC = function (className, classMap, classMapValueCache) { |
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.
这个global.__GCC也可以考虑改成参数传递的形式,而不是走全局对象访问
1.z-index auto 报错
2.样式编译优化:es6语法+__formatValue简化
3.去掉 translate & border-radius 的百分比计算 & 保留 translateY calc(100% - 20px)的百分比计算
4.支持transform 分开定义 css var 且包含未定义值的var变量,如 --un-translate-x: -50%;transform translateX(var(--un-translate-x)) translateY(var(--un-translate-y));
5.去掉非媒体查询场景下的_default&_media字段