我正在尝试通过 tailwindcss 麦粒肿更改文本的默认颜色。但我不明白为什么它不起作用。但 Bootstrap 确实会覆盖默认样式。
我是 tailwindcss 的新手。有人能告诉我这里发生了什么事吗?
在这里您可以在codesandbox中编辑 https://codesandbox.io/s/vue-template-82b4b?file=/src/components/HelloWorld.vue
<template>
<div class="hello">
<h1 class="origintxt text-green-400">{{ msg }}</h1>
</div>
</template>
<script>
export default {
name: "HelloWorld",
props: {
msg: String
}
};
</script>
<style scoped>
.origintxt {
color: black;
}
</style>
问题出在我的tailwind.config.js
文件。刚刚在阅读文档时发现了这一点。
默认情况下,tailwind 的所有 css 都没有生成!important
。要启用它,您必须添加important: true
在配置文件中。然后它将覆盖以前的类属性。
// tailwind.config.js
module.exports = {
important: true,
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)