
如题,有些控件不能通过 class 或者 className, 如何应用 tailwind 的样式呢,如指定字体
1 ericguo 2024 年 4 月 17 日 二选一,要么不要用这样的控件(比如 AntD ),要么不要用 Tailwind 。 |
3 youtubbbbb 2024 年 4 月 17 日 可以用 useRef 通过操作 DOM 去加 class ,但是这种写法是不推荐的。 |
4 northquq 2024 年 4 月 17 日 @youtubbbbb 这种动态加的方法,不一定能被 tailwind 识别出来,导致编译后丢失 class 对应的样式吧 |
5 mooooooooooe 2024 年 4 月 17 日 二楼正解 |
6 epiloguess 2024 年 4 月 17 日 外面套个娃? |
8 Pencillll 2024 年 4 月 18 日 via Android 用 arbitrary variants 就行了,在控件外面的父元素写个 class ,比如: [&_.xxx]:font-sans [&>div>span]:font-sans [&_*]:!font-sans 参考: https://tailwindcss.com/docs/hover-focus-and-other-states#using-arbitrary-variants |
9 devzhaoyou OP 感觉各位,验证一下各位的方案,感谢 |
10 lawted 2024 年 4 月 18 日 使用 shadcn 或者 headless ui |
11 ericguo 2024 年 4 月 20 日 |