vue3、vue2 的 main.js 文件区别

vue2:

import Vue from 'vue'
import App from './App.vue'
import Vue from './router'
import store from './store'
//引入Element-ui
import ElementUI from 'element-ui'

Vue.config.productionTip = false;
Vue.use(ElementUI)
Vue.prototype.$http = ()=>{
	console.log(xxx)
}

new Vue({
	router,
	store,
	render: (h) => h(App),
}).$mount('#app')

vue3:

import {createApp }from 'vue'
import App from './App.vue'
import Vue from './router'
import store from './store'
import ElementUI from 'element-ui'

const app = createApp(App)
app.config.globalProperties.$http = ()=>{
	console.log(xxx)
}
app.use(ElementUI )
app.use(store).use(router).mount('#app')

转自:https://www.bilibili.com/video/BV1yy4y1k7bj

Logo

前往低代码交流专区

更多推荐