Skip to content
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

【快应用】Taroize之后转快应用,大量样式报错 #4288

Closed
Qiyu8 opened this issue Aug 26, 2019 · 2 comments · Fixed by #4301
Closed

【快应用】Taroize之后转快应用,大量样式报错 #4288

Qiyu8 opened this issue Aug 26, 2019 · 2 comments · Fixed by #4301

Comments

@Qiyu8
Copy link
Collaborator

Qiyu8 commented Aug 26, 2019

问题描述
快应用支持的通用样式参考:https://doc.quickapp.cn/widgets/common-styles.html
可见快应用中样式的取值和样式均有很大的局限性,如果微信小程序中编写了超出这个范围的样式,在Taroize之后转微信小程序问题不大,但是转快应用的话,快应用编译器就会大量报错,导致无法预览快应用,实际项目样式报错14000+,严重影响开发体验。
Eg:微信小程序中写法

.a {
  background-color:#ccc !important;
  backgournd: #ffffff;
  font-size:90rpx;
}

在快应用中会报错
Attribute 'background-color' value '#ccc !important' is incorrect
Attribute 'backgournd' value '#ffffff' is incorrect value
Attribute 'font-size' dose not support unit 'rpx',At present only [px, %] is supported

复现步骤
1.在微信小程序根目录执行 taro convert
2.在taroConvert目录执行 taro build --type quickapp
期望行为
所有快应用不支持的样式值和样式都注释掉,可以正常进行快应用预览

报错信息
Attribute 'background-color' value '#ccc !important' is incorrect
Attribute 'backgournd' value '#ffffff' is incorrect value
Attribute 'font-size' dose not support unit 'rpx',At present only [px, %] is supported

系统信息
操作系统: Windows 10
Taro 版本 v1.3.14
Node.js 版本 v12.7.0
报错平台 weapp
补充信息
优化点:在转换过程中如果识别出来是快应用不支持的样式,直接注释掉并给出修改建议,可以使用css组件的Ast解析技术重写css规则来实现

@taro-bot
Copy link

taro-bot bot commented Aug 26, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@luckyadam
Copy link
Member

样式没有办法帮忙做转换的,快应用支持的样式太少了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants