ant-design / ant-design-mobile

Essential UI blocks for building mobile web apps.
https://mobile.ant.design
MIT License
11.64k stars 2.4k forks source link

高清化方案讨论 #21

Closed pingan1927 closed 8 years ago

pingan1927 commented 8 years ago

代码写 rem

还有一个问题,组件代码的1px高清方案是基于initial-scale=1这样的viewport设置的,一旦使用rem,用户可能就会使用initial-scale=1/dpr的高清方案,这个时候,组件的1px可能就变为1/dpr^2了,需要考虑这种情况吗?

关于是否使用rem,1.0版我们总结一个最后方案吧。越早确定约好

代码写 px

按照 750 设计稿的标注写 px ,由工具转换成: https://github.com/ant-tool/postcss-plugin-px2rem ,然后经过一些动态页面设置: http://yiminghe.me/lab/playground/2016-exams/6.html 等比缩放.

pingan1927 commented 8 years ago

另外,AntUI目前的1px问题使用的是设置initial-scale=1/dpr这种解决方案,跟antd-mobile不一样了。

hotoo commented 8 years ago

目前团队内部主要还是 1rem = 100px,主要好处是便于换算。

fangk commented 8 years ago

fi/x/issues/113 在内网有撕逼帖.

1rem=100px是现阶段团队内用的最多的. 也就是0.16rem=16px;

antui里是1:200, 也就是0.16rem = 32px; 他们习惯了除以2

pingan1927 commented 8 years ago

关于样式,react组件库(antd-mobile)业务开发时有一个纯的样式库依赖(默认antui),也可以引入其它UI依赖,两者能够无缝配合最好。

yiminghe commented 8 years ago

@warmhug @afc163

afc163 commented 8 years ago

同意 1rem=100px

pingan1927 commented 8 years ago

那等样式的value都改为变量之后,我来进行切换吧。

方案就是约定1rem=100px

warmhug commented 8 years ago

我理解是,rem 在业务中适配不同屏幕时比较方便,用 media query 或动态js计算、就能做到只需改变不同分辨率设备下的html font-size 大小就能完全适配,包括 viewport 的缩放也是为了页面看起来高清?但组件库里的代码,有必要都改为 rem 吗?我没找到过别的库有这么做?

pingan1927 commented 8 years ago

有必要都改为 rem 吗?我没找到过别的库有这么做?

这是第一个问题要探讨的,是否rem化?

这有点类似typeScript,提供的是一种能力。

对于是否切换到rem,这个是讨论贴,最后大家统一意见后再着手改代码。

shepherdwind commented 8 years ago

我们如果就内部用,rem 没问题,按照现有的标准就好。但 rem 和 px 完全不兼容的,如果我们的组件需要对外,那么外部用户就得全家桶搞过来,这对业务侵入性还是蛮大的,要统一这样一个比例还是很难的。

我觉得应该保持 rem 和 px 生成的能力,比如通过构建工具或者 less 变量定义的模式。现在可以用 rem 模式,未来高清方案 android 也支持 0.5 px 的实现,那时候应该没必要用缩放了吧。

shepherdwind commented 8 years ago

缩放好像有一个比较致命的缺点,微信不支持缩放,对于外部用户来说,可能还是比较重要的吧。

yiminghe commented 8 years ago

https://github.com/ant-design/ant-design-mobile/issues/78

yiminghe commented 8 years ago

确定,方案2

dyf2015 commented 8 years ago

高清方案ios8下无效。。

pingan1927 commented 8 years ago

你的viewport这个meta信息必须是通过脚本进行修改,如果html已经写入,需要先删除掉。 @dyf2015

ghost commented 7 years ago

Hello, 用的是 Wiki 的高清方案,同是一样的字体大小,目前测的是 Picker 组件的,发现会模糊,如图:

majq0p29a mko5 u rlp68f


这样就不会模糊:

4 sd6fhivs3s 2n7 hddop5

warmhug commented 7 years ago

@pingan1927 帮 @motorguo 看看

lock[bot] commented 6 years ago

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.