fix(ts): fix $nuxt.$loading typedefs (#4778)

* feat(ts): improve typedefs of `$nuxt.$loading`

* fix: remove useless new line
This commit is contained in:
Kevin Marrec 2019-01-17 18:29:01 +01:00 committed by Sébastien Chopin
parent add233ce80
commit 6694cf706b
2 changed files with 16 additions and 5 deletions

View File

@ -62,11 +62,16 @@ export interface ErrorParams {
message?: string; message?: string;
} }
export interface NuxtLoading extends Vue {
fail?(): void;
finish(): void;
increase?(num: number): void;
pause?(): void;
start(): void;
}
export interface NuxtApp extends Vue { export interface NuxtApp extends Vue {
$loading: NuxtLoading;
isOffline: boolean; isOffline: boolean;
isOnline: boolean; isOnline: boolean;
$loading: {
start(): void;
finish(): void;
};
} }

View File

@ -87,5 +87,11 @@ options.watchQuery = ['foo', 'bar']
const vm = new Vue(options) const vm = new Vue(options)
vm.$nuxt.$loading.start() if (vm.$nuxt.$loading.fail) vm.$nuxt.$loading.fail()
vm.$nuxt.$loading.finish() vm.$nuxt.$loading.finish()
if (vm.$nuxt.$loading.increase) vm.$nuxt.$loading.increase(1)
if (vm.$nuxt.$loading.pause) vm.$nuxt.$loading.pause()
vm.$nuxt.$loading.start()
vm.$nuxt.isOffline = true
vm.$nuxt.isOnline = true