【Vue3.0】报错 Cannot read properties of undefined (reading ‘use‘)

vue3.0 项目引用element-plus,运行项目报错,main.js代码如下

import Vue from 'vue'
import { createApp } from 'vue'
import App from './App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

Vue.use(ElementPlus)
createApp(App).mount('#app')

vue3.0 main.js正确写法

import { createApp } from 'vue'
import App from './App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

const app = createApp(App)

app.use(ElementPlus)
app.mount('#app')

你可能感兴趣的:(前端,html,vue.js,javascript,前端)