根据这篇https://blog.csdn.net/GongWei_/article/details/109986596
配置下来,发现还是不生效,折腾半天之后发现,由于我用了router,所以我没动最后一句“createApp(App).use(router).mount(’#app’)”,我的main.js是这么改的:
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus';
import 'element-plus/lib/theme-chalk/index.css';
const app = createApp(App)
app.use(ElementPlus)
createApp(App).use(router).mount('#app')
片头所提文章是这样的:
import { createApp, Vue } from 'vue';
import ElementPlus from 'element-plus';
import 'element-plus/lib/theme-chalk/index.css';
import App from './App.vue';
const app = createApp(App)
app.use(ElementPlus)
app.mount('#app')
后来发现,要这么改:
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus';
import 'element-plus/lib/theme-chalk/index.css';
const app = createApp(App)
app.use(ElementPlus)
app.use(router).mount('#app')
这样的话createApp(App)才指的是一个app…
改完element-plus立马生效
(初学vue,不喜勿喷)