-
Notifications
You must be signed in to change notification settings - Fork 83
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
引入全局样式优先级会低于elementPlus,有什么方法可以解决吗,在nuxt2的时候不会这样子 #75
Comments
有同样的问题。 |
试下这样: export default defineNuxtConfig({
devtools: { enabled: true },
css: [
'@/assets/scss/element.scss',
'@/assets/scss/index.scss', // 这里就是你定义的样式
'--other styles --',
],
vite: {
// css: {
// preprocessorOptions: {
// scss: {
// additionalData: `@use "@/assets/scss/element/index.scss" as element;`,
// },
// },
// },
},
modules: ["@element-plus/nuxt"],
elementPlus: {
importStyle: false, // 不用插件导入样式
},
}); 而在 $-colors: (
'primary': ('base': rgba(107, 33, 168, 1),
),
'success': ('base': #67c23a,
),
'warning': ('base': #e6a23c,
),
'danger': ('base': #f56c6c,
),
'error': ('base': #f56c6c,
),
'info': ('base': #909399,
),
);
@forward 'element-plus/theme-chalk/src/common/var.scss' with ($colors: $-colors);
@import 'element-plus/theme-chalk/src/index.scss'; |
这样引入全部样式然后怎么去掉未使用的样式呢,@fullhuman/postcss-purgecss 好像用不了 |
...那这样:建一个
嘿嘿,办法总比困难多。 |
这样就会有这个优先级的问题了 |
你是不是搞错了,这样就解决了 引用顺序的问题啊~
再
components/base/App.vue
自定义组件的 css 会最后加载,没问题啊~ |
The text was updated successfully, but these errors were encountered: