Reputation: 101
Below code is in Vue 2 version. Can someone tell me what is the Vue 3 version for this main.js please. sorry if my english is bad. i want to change my tutorial project to Vue 3 because Vue 2 has so many errors in console that i can't solved.
import Vue from 'vue'
import App from './App.vue'
import './registerServiceWorker'
import router from './router'
import store from './store'
import axios from 'axios'
import VueAxios from 'vue-axios'
Vue.config.productionTip = false
Vue.use(VueAxios, axios)
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
Upvotes: 0
Views: 89
Reputation: 2691
This option is possible
import { createApp } from 'vue'
import App from './App.vue'
import './registerServiceWorker'
import router from './router'
import store from './store'
import axios from 'axios'
import VueAxios from 'vue-axios'
const app = createApp(App)
app.use(VueAxios,axios)
app.use(store)
app.use(router)
app.mount('#app')
Upvotes: 1
Reputation: 101
I got the answer right.
import { createApp } from 'vue'
import App from './App.vue'
import './registerServiceWorker'
import router from './router'
import store from './store'
import axios from 'axios'
import VueAxios from 'vue-axios'
createApp(App).use(store).use(router).use(VueAxios,axios).mount('#app')
Upvotes: 0