Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
309 views
in Technique[技术] by (71.8m points)

javascript - 断点CSS不适用于React-jss中的props(Breakpoints css is not applied over props in React-jss)

I am getting an issue with React-JSS.(我在React-JSS上遇到问题。)

I have created a modal class for which the property of height depends on the prop passed to the component.(我创建了一个模态类,其高度属性取决于传递给组件的道具。) In responsive design I want the height to be 100% but somehow it is not getting priority in CSS because React-JSS creating two classes when I used props inside styles.(在响应式设计中,我希望高度为100%但由于CSS在我在样式中使用props时创建了两个类,因此它在CSS中没有得到优先考虑。) React JSS Code(反应JSS代码) modal: { borderRadius: 10, width: 750px, height: ({ height = 550 } => height, [breakpoints.MOBILE]: { height: 'auto', }, }, Output(输出量) It creates two classes because I am accessing props in the styles and media queries not getting priority.(它创建了两个类,因为我正在访问样式的道具,而媒体查询没有得到优先权。) 在此处输入图片说明 Looking forward for help.(期待获得帮助。)   ask by sarabs3 translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Your both classes are different so its not working.(您的两个类都不相同,因此无法正常工作。)

.Modal-modal-0-0-2-179{ ... }(.Modal-modal-0-0-2-179 {...}) .Modal-modal-0-0-2-177{ ... }(.Modal-modal-0-0-2-177 {...})

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...