-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
两个页面共用一个组件,页面返回保留上一个页面的组件样式 #17159
Comments
这个原因主要是这个:
临时解决方案:可以包裹一层,提升 customClass 的权重,类似 .index {
.customClass{
background-color: red;
}
} 我看下能不能在详情页卸载的时候卸载 css 文件,或者做下页面间的样式隔离。 |
This was referenced Jan 11, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
相关平台
H5
复现仓库
https://github.com/Sylvia-00/taro-demo.git
浏览器版本: Chrome131.0.6778.205、Edge131.0.2903.112
使用框架: React
复现步骤
样式使用css module;
1、构建成H5打开(build:h5)- ListWrapper组件(组件内部颜色粉色);
2、首页引入ListWrapper组件,配置样式为红色(显示正常);
3、从首页点击按钮跳转到详情页,详情页ListWrapper组件,配置样式为蓝色(显示正常);
4、从详情页返回到首页,首页的ListWrapper组件样式重置为组件内部样式(显示粉色;
期望结果
希望第四点的样式为第2点一致(显示红色);
首页不应该把存在详情页的样式;
实际结果
从详情页返回到首页,首页的ListWrapper组件样式重置为组件内部样式(显示粉色);
且审查首页元素样式有两个一样的ListWrapper组件样式,首页配置的样式被详情页组件的默认样式覆盖了
环境信息
The text was updated successfully, but these errors were encountered: