AI助手支持GPT4.0
【已解决】自定义组件为何不支持全局样式的直接使用?[Solved] Why does the custom component not support the direct use of global styles?
【已解决】自定义组件为何不支持全局样式的直接使用?
问题:自定义组件,若不在组件样式文件中手动引入全局样式,渲染后的组件实例直接样式丢失。
@import "../../app.wxss"
建议:直接使用,无需手动引入。
---------------------------------------
已解决:有相同疑惑的朋友及时补课【组件样式隔离】https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html#%E7%BB%84%E4%BB%B6%E6%A0%B7%E5%BC%8F%E9%9A%94%E7%A6%BB
Problem: for custom components, if the global style is not manually introduced into the component style file, the rendered component instance will lose the style directly// component. wxss@import ".. /.. / APP. Wxss" / / introduce a global style!!! OMG! Isn't this a completely redundant operation? Logic and use experience, no matter which angle, seem not to be like this. Suggestion: it can be used directly without manual introduction--------------------------------------- Solved: friends with the same doubts make up lessons in time [component style isolation] https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html#%E7%BB%84%E4%BB%B6%E6%A0%B7%E5%BC%8F%E9%9A%94%E7%A6%BB
支持的
Component({ options: { styleIsolation: 'apply-shared' }})// orComponent({ options: { addGlobalClass: true }})