编辑:因为我不能弄清楚这一点,所以我放弃了Vue3,回到了Vue2,并切换到了Vuetify。
我对Vue完全陌生,决定在项目中使用Vue 3,这将导致我的硕士论文。由于没有太多的UI库被更新为在Vue 3上运行,我决定使用Primevue。
目前我正在尝试将Primevue的一个主题应用到我的项目中,但结果并不是很令人满意。我使用的是深色主题,但背景是白色的,而组件则使用主题作为背景和常规样式。

我希望有人能够帮助正确地应用样式。
作为一个额外的问题,我想知道是否更好的降级到Vue 2,并使用更成熟的UI库,如Vuetify或BootstrapVue。
main.js
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import TieredMenu from 'primevue/tieredmenu';
import InputSwitch from 'primevue/inputswitch';
// import 'primevue/resources/themes/bootstrap4-light-blue/theme.css';
import 'primevue/resources/themes/bootstrap4-dark-blue/theme.css';
import 'primevue/resources/primevue.min.css';
import 'primeicons/primeicons.css';
import 'primeflex/primeflex.css';
const app = createApp(App);
app.use(store)
.use(router)
.use(VueApexCharts)
.use(VueEllipseProgress)
.component('TieredMenu', TieredMenu)
.component('InputSwitch', InputSwitch)
.mount('#app')App.vue
<template>
<div id="namegoeshere" >
<router-view/>
<div id="nav">
<!--<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link>-->
</div>
</div>
</template>
<style >
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
#nav {
padding: 30px;
}
#nav a {
font-weight: bold;
color: #2c3e50;
}
#nav a.router-link-exact-active {
color: #42b983;
}
</style>发布于 2021-03-26 18:36:33
我遇到了类似的问题,使用devtools查看了prime-vue文档站点,发现主体上设置了以下代码:
body {
margin: 0;
height: 100%;
overflow-x: hidden;
overflow-y: auto;
background-color: var(--surface-a);
font-family: var(--font-family);
font-weight: 400;
color: var(--text-color);
}这里使用的变量来自加载的主题。这为我解决了这个问题。
我在文档中找不到任何关于必须设置这个的直接信息。
https://stackoverflow.com/questions/64983610
复制相似问题