f / vue-wait

Complex Loader and Progress Management for Vue/Vuex and Nuxt Applications
MIT License
2k stars 101 forks source link

Vue 3 support for vue-wait #106

Closed SinanMtl closed 3 years ago

SinanMtl commented 3 years ago

Hi folks! I present you to Vue 3.x support. With Vue 3 some breaking changes happend. One of these is plugin registration. Plugin registration like below in Vue 2.x:

import VueWait from 'vue-wait'

Vue.use(VueWait)

With new version, this implementation changed with that. Let's look at example from Vuex:

import { createApp } from 'vue'
import { createStore } from 'vuex'
import App from './App.vue'

const store = createStore({
  state () {
    return {
      count: 0
    }
  },
  mutations: {
    increment (state) {
      state.count++
    }
  }
})

createApp(App).use(store).mount('#app');

According to new implementation, I have been added an install function for Vue 3.x. New registration looks like this:

import { createApp } from 'vue'
import { createVueWait } from 'vue-wait'
import App from './App.vue'

const VueWait = createVueWait({
  useVuex: false,
  registerComponent: true
});

createApp(App).use(VueWait).mount('#app');