We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
shadow dom 支持使用 :host 来设置外层标签的样式,我看到你每个示例下面都有个 wxss 文件,而文件的内容都一样,都是:
/**index.wxss**/ ec-canvas { width: 100%; height: 100%; }
其实微信支持在你的组件中设置 :host 的,如在 ec-canvas.wxss 中添加这样的代码
:host { display: block; width: 100%; height: 100%; }
然后你所有示例的的 index.wxss 都可以删除了,而且我觉得这样设置也符合用户的习惯吧!
微信官方关于 :host 的使用在此: https://mp.weixin.qq.com/debug/wxadoc/dev/framework/custom-component/wxml-wxss.html#%E7%BB%84%E4%BB%B6%E6%A0%B7%E5%BC%8F
不过有个问题是 :host 设置的样式要比外层的标签选择器的优先级高,比外层的 class 选择器的优先级低;感觉这应该是微信的 bug。
shadow dom 的官方定义是 :host 指定的样式优先级是最低的: https://developers.google.com/web/fundamentals/web-components/shadowdom#host
The text was updated successfully, but these errors were encountered:
没有提 pr ,感觉你不一定会接受
Sorry, something went wrong.
等我有时间研究下哈~ 当然,PR 是坠吼的!
No branches or pull requests
shadow dom 支持使用 :host 来设置外层标签的样式,我看到你每个示例下面都有个 wxss 文件,而文件的内容都一样,都是:
其实微信支持在你的组件中设置 :host 的,如在 ec-canvas.wxss 中添加这样的代码
然后你所有示例的的 index.wxss 都可以删除了,而且我觉得这样设置也符合用户的习惯吧!
微信官方关于 :host 的使用在此: https://mp.weixin.qq.com/debug/wxadoc/dev/framework/custom-component/wxml-wxss.html#%E7%BB%84%E4%BB%B6%E6%A0%B7%E5%BC%8F
不过有个问题是 :host 设置的样式要比外层的标签选择器的优先级高,比外层的 class 选择器的优先级低;感觉这应该是微信的 bug。
shadow dom 的官方定义是 :host 指定的样式优先级是最低的: https://developers.google.com/web/fundamentals/web-components/shadowdom#host
The text was updated successfully, but these errors were encountered: