如何指定样式表在文档中出现的顺序? [英] How to specify the order in which the style sheets appear in the document?

查看:89
本文介绍了如何指定样式表在文档中出现的顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个样式化的组件,使用withStyles HOC导出它们,但是我无法覆盖一些规则,因为jss将mui样式表的顺序与组件的样式表混合在一起.

I have several styled components, using the withStyles HOC to export them, but i can't override some rules because jss mix the order of mui stylesheets with my component's stylesheets.

如何将样式推到最后?

推荐答案

我和我的团队也偶然发现了这一点,我们设法找到了解决方案.显然, withStyles 使用一个 option 对象作为参数.因此,为了解决此问题,您需要传递一个值为 1 的参数 index .所以,您得到的是这样:

Me and my team also stumbled upon this and we managed to find a solution. Apparently withStyles, takes an option object as parameter. So in order to solve this issue, you need to pass a parameter index with a value of 1. So what you get is this:

withStyles(styles, {index: 1})(yourComponent)

这篇关于如何指定样式表在文档中出现的顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆