vue2在main.js中代码:
import Vue from 'vue'
import App from './App.vue'
import store from './store'
new Vue({
el: '#app',
store,
render: h => h(App)
})
router和store一样,import之后加在和store同一级
vue3使用createApp:
import { createApp } from 'vue'
import App from './App.vue'
import store from './store'
createApp(App).use(store).mount('#app')
router也和store一样,再加个.use(router)