简体   繁体   English

如何在 css-in-js Emotion 中通过自动生成的类名搜索代码?

[英]How can I, search a code by auto generated classes names in css-in-js Emotion?

In the project, I ran into CSS-IN-JS implemented using Emotion.在项目中,我遇到了使用 Emotion 实现的 CSS-IN-JS。 Usually, I look for the code of corresponding components by the names of the CSS styles, but due to the generated styles names, I feel a lot of pain when I tried to find an element from the browser in project code.通常,我是通过CSS styles的名称来查找对应组件的代码,但是由于生成的styles名称,当我尝试从浏览器中找到一个元素时,我感到很痛苦。

Actually, the question is, can I somehow add "names" for Emotion styles, so that at least part of the generated name will be human-readable?实际上,问题是,我能否以某种方式为 Emotion styles 添加“名称”,以便生成的名称至少有一部分是人类可读的?

If it is impossible, share how you find the “element” that you see in the browser in the project code?如果不可能,分享一下你是如何在项目代码中找到你在浏览器中看到的“元素”的?

在此处输入图像描述

Emotion provides a way of appending a label to the end of the class name, via a label prop. Emotion 提供了一种通过label属性将 label 附加到 class 名称末尾的方法。 You can read about it in the official docs .您可以在官方文档中了解它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM