-
Notifications
You must be signed in to change notification settings - Fork 8
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
supported more css units #5
base: master
Are you sure you want to change the base?
Conversation
alibaba/weex#1894 related |
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.
OK. Please make sure that all css units in the list are supported by weex-vue-loader
and jsfm
.
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.
Retain the style units in transformer is fine.
But only change the weex-loader
may not support the CSS units very well. The real value of the style needs to be calculated in real time.
Consider this:
<div style="width: {{width}}; height: {{height}}"><div>
this.width = '32rem'
this.height = this.getHeight() / 25 + 'vh'
Just this.width = 32 * CSS_UNIT.REM
this.height = this.getHeight() / 25 * CSS_UNIT.VH is OK. The variable CSS_UNIT could be exposed to frontend developers |
Another thing is at least we can make it happen before native render support these units. And maybe that's enough already. |
Support more CSS units without native update.
Three updates together:
css-units
branch inweexteam/weex-styler
weex-next
branch inweexteam/weex-vue-loader
jsfm-feature-css-units
injinjiang/weex
How it works: CSS value
100rem
in<style>
will be transformed into"100rem"
byweex-styler
and then100 * CSS_UNIT.REM
byweex-vue-loader
. At the same time define global variableCSS_UNIT
in JS Framework. So it works.