Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

185
Views
Vue 3 use function not works

I tried to upgrade one of my apps from Vue 2 to Vue 3. Unfortunately I can't use: Vue.use() function. For example my code in Vue 2:

import Vue from 'vue'
import App from './App.vue'
import store from './store'
import router from './router'
import VueCookie from 'vue-cookie'

Vue.use(VueCookie);


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

Same in Vue 3:

import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import { store } from './store'
import VueCookie from 'vue-cookie'

//Vue.use(VueCookie); //old line in vue 2
createApp.use('VueCookie'); //this is not works and return error

createApp(App).use(router,store).mount('#app') //Is this line correct?

What am I missing here?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Try like following, first define app then use it:

import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import VueCookie from 'vue-cookie'

const app = createApp(App);

app.use(router);
app.use(store);
app.use(VueCookie);
app.mount('#app')
about 4 years ago · Juan Pablo Isaza Report

0

You can use it like:

  import VueCookie from 'vue-cookie'

  VueCookie.set("mycookie", "value", "1h")
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!