mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(ts): fix $nuxt.$loading
typedefs (#4778)
* feat(ts): improve typedefs of `$nuxt.$loading` * fix: remove useless new line
This commit is contained in:
parent
add233ce80
commit
6694cf706b
13
packages/vue-app/types/index.d.ts
vendored
13
packages/vue-app/types/index.d.ts
vendored
@ -62,11 +62,16 @@ export interface ErrorParams {
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface NuxtLoading extends Vue {
|
||||
fail?(): void;
|
||||
finish(): void;
|
||||
increase?(num: number): void;
|
||||
pause?(): void;
|
||||
start(): void;
|
||||
}
|
||||
|
||||
export interface NuxtApp extends Vue {
|
||||
$loading: NuxtLoading;
|
||||
isOffline: boolean;
|
||||
isOnline: boolean;
|
||||
$loading: {
|
||||
start(): void;
|
||||
finish(): void;
|
||||
};
|
||||
}
|
||||
|
@ -87,5 +87,11 @@ options.watchQuery = ['foo', 'bar']
|
||||
|
||||
const vm = new Vue(options)
|
||||
|
||||
vm.$nuxt.$loading.start()
|
||||
if (vm.$nuxt.$loading.fail) vm.$nuxt.$loading.fail()
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user