-
-
Notifications
You must be signed in to change notification settings - Fork 91
bg-[#123456]与bg-blue-500/50不生效 #28
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
Comments
我试了一下我的 |
要不你参考一下我的 https://github.com/sonofmagic/uni-app-vite-vue3-tailwind-vscode-template 看看把,这里是配置好的。 |
https://github.com/hfut-soft-ware/hfut-helper 就默认的home组件,我定义card的颜色的时候用bg-[#xxxxxx]就不想 |
我试了一下还是不行 |
我试了一下你的项目,你要把 |
好的感谢 |
我重新试了一下,发现可以 |
我看是我那个插件没起作用啊,你更换到我刚刚那个正确的插件顺序,重启一下试试呢 |
我的意思是,我试过在for循环之外的组件 |
这样啊,我去看看编译产物哈 |
我找到原因了,原因实际上是因为你的 这一部分js里面去 setData 切换 class 的时候, 所以你的 |
我在其他地方试了一下for循环能不能产生颜色,发现可以正常运行 我试了一下在web上也可以一样运行,所以我感觉是我的用法问题 https://stackblitz.com/edit/vitejs-vite-auevjk?file=src%2Fmain.js&terminal=dev |
或者你可以这样理解,转义只针对, 和 <style> |
h5 这样写是可以的,小程序平台这样写,目前还不支持,因为h5平台,本质上都是一体的,小程序是有视图层view和逻辑层js的 h5和小程序的提取器也不同,这导致h5是都能提取的,小程序只能提取 |
但我试了一下其他地方的for循环,发现是可行的 <view v-for="color in cardsColor" :class="color">
{{ color }}
</view> |
嗯,就一些即时编译的失效了,普通的不会失效,因为普通的转义后还是一样的 |
感谢,看起来只能用 |
我在 import { replaceJs } from 'weapp-tailwindcss-webpack-plugin/replace'
const cardsColor = reactive([
replaceJs('bg-[#4268EA] shadow-indigo-100'),
replaceJs('bg-[#123456] shadow-blue-100') ,
'bg-green-500 shadow-green-100',
'bg-cyan-500 shadow-cyan-100',
'bg-amber-500 shadow-amber-100',
]) 然后再在 <view :key="i" class="h-[20px] w-[20px]" :class="cardsColor[i - 1]" v-for="i in 5"></view> 这样就可以生效了,可以尝试一下 |
跑完步去试试 |
同时你不用担心把代码都打进来导致体积过大,我在 'weapp-tailwindcss-webpack-plugin/replace' 中通过 |
Uh oh!
There was an error while loading. Please reload this page.
写bg-[#123456]与bg-blue-500/50在类名里面不生效
但这样做就生效
@apply bg-[#123456]
The text was updated successfully, but these errors were encountered: