|
5 | 5 |
|
6 | 6 | import Vue, { VNode } from 'vue';
|
7 | 7 |
|
8 |
| -declare namespace InfiniteLoading { |
9 |
| - type SpinnerType = 'default' | 'bubbles' | 'circles' | 'spiral' | 'waveDots'; |
10 |
| - |
11 |
| - type DirectionType = 'top' | 'bottom'; |
12 |
| - |
13 |
| - interface Slots { |
14 |
| - spinner: VNode[]; |
15 |
| - 'no-result': VNode[]; |
16 |
| - 'no-more': VNode[]; |
17 |
| - [key: string]: VNode[]; |
18 |
| - } |
19 |
| - |
20 |
| - interface StateChanger { |
21 |
| - loaded(): void; |
22 |
| - complete(): void; |
23 |
| - reset(): void; |
24 |
| - } |
| 8 | +export type SpinnerType = 'default' | 'bubbles' | 'circles' | 'spiral' | 'waveDots'; |
| 9 | +export type DirectionType = 'top' | 'bottom'; |
| 10 | + |
| 11 | +export interface Slots { |
| 12 | + spinner: VNode[]; |
| 13 | + 'no-result': VNode[]; |
| 14 | + 'no-more': VNode[]; |
| 15 | + [key: string]: VNode[]; |
25 | 16 | }
|
26 | 17 |
|
27 |
| -declare class InfiniteLoading extends Vue { |
| 18 | +export interface StateChanger { |
| 19 | + loaded(): void; |
| 20 | + complete(): void; |
| 21 | + reset(): void; |
| 22 | +} |
| 23 | + |
| 24 | +export default class InfiniteLoading extends Vue { |
28 | 25 | // The trigger distance
|
29 | 26 | distance: number;
|
30 | 27 |
|
31 | 28 | // The load spinner type
|
32 |
| - spinner: InfiniteLoading.SpinnerType; |
| 29 | + spinner: SpinnerType; |
33 | 30 |
|
34 | 31 | // The scroll direction
|
35 |
| - direction: InfiniteLoading.DirectionType; |
| 32 | + direction: DirectionType; |
36 | 33 |
|
37 | 34 | // Whether find the element which has `infinite-wrapper` attribute as the scroll wrapper
|
38 | 35 | forceUseInfiniteWrapper: boolean;
|
39 | 36 |
|
40 | 37 | // Infinite event handler
|
41 |
| - onInfinite: ($state: InfiniteLoading.StateChanger) => void; |
| 38 | + onInfinite: ($state: StateChanger) => void; |
42 | 39 |
|
43 | 40 | // The method collection used to change infinite state
|
44 |
| - stateChanger: InfiniteLoading.StateChanger; |
| 41 | + stateChanger: StateChanger; |
45 | 42 |
|
46 | 43 | // Slots
|
47 |
| - $slots: InfiniteLoading.Slots; |
| 44 | + $slots: Slots; |
48 | 45 | }
|
49 | 46 |
|
50 |
| -export default InfiniteLoading; |
0 commit comments