Skip to content

Commit e663c53

Browse files
authored
Merge pull request #272 from chantouchsek/bugfix/fix-nuxt-inejct-error
Fix nuxt inject loop
2 parents f7e579f + 0ef121c commit e663c53

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

nuxt/vue-waiting.template.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ import VueWaiting from 'vue-waiting';
33

44
Vue.use(VueWaiting);
55

6-
const pluginOptions = <%= serialize(options) %>
7-
const waiting = new VueWaiting(pluginOptions)
8-
96
export default ({ app }, inject) => {
10-
inject('waiting', waiting)
7+
const pluginOptions = <%= serialize(options) %>
8+
app.waiting = new VueWaiting(pluginOptions)
9+
inject('wait', app.waiting)
1110
}

src/vue-waiting.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
import { mapWaitingActions, mapWaitingGetters, waitFor } from './helpers'
1414

1515
import vuexStore from './vuex/store'
16-
import vWaitingComponent from './components/v-waiting.vue'
16+
import VWaiting from './components/v-waiting.vue'
1717
import vWaitingDirective from './directives/waiting.js'
1818

1919
export default class VueWaiting {
@@ -46,7 +46,7 @@ export default class VueWaiting {
4646
}
4747

4848
if (this.options.registerComponent) {
49-
Vue.component(this.options.componentName, vWaitingComponent)
49+
Vue.component(this.options.componentName, VWaiting)
5050
}
5151

5252
if (this.options.registerDirective) {
@@ -206,11 +206,6 @@ export function install(Vue) {
206206
}
207207

208208
// Export which are imported to export
209-
export {
210-
mapWaitingActions,
211-
mapWaitingGetters,
212-
waitFor,
213-
vWaitingComponent as VWaiting,
214-
}
209+
export { waitFor, VWaiting, mapWaitingActions, mapWaitingGetters }
215210

216211
VueWaiting.install = install

types/vue.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import VueWaiting from './';
77

88
declare module '@nuxt/types' {
99
interface Context {
10-
$waiting: VueWaiting;
10+
$wait: VueWaiting;
1111
}
1212
interface NuxtAppOptions {
13-
$waiting: VueWaiting;
13+
$wait: VueWaiting;
1414
}
1515
}
1616

0 commit comments

Comments
 (0)