[new feature] add Notify component (#2135)

This commit is contained in:
neverland
2018-11-25 10:36:07 +08:00
committed by GitHub
parent 00458839a2
commit eb44209a5a
22 changed files with 465 additions and 5 deletions

2
types/index.d.ts vendored
View File

@@ -2,6 +2,7 @@ import Vue from 'vue';
import { VanComponent } from './component';
import { Toast } from './toast';
import { Dialog } from './dialog';
import { Notify } from './notify';
import { Locale } from './locale';
import { Lazyload } from './lazyload';
import { Waterfall } from './waterfall';
@@ -74,6 +75,7 @@ export class Uploader extends VanComponent {}
export {
Toast,
Dialog,
Notify,
Locale,
Lazyload,
Waterfall,

32
types/notify.d.ts vendored Normal file
View File

@@ -0,0 +1,32 @@
import Vue from 'vue';
type NotifyMessage = string | number;
export type NotifyOptions = {
message?: NotifyMessage;
color?: string;
background?: string;
duration?: number;
}
export interface VanNotify extends Vue {
message: NotifyMessage;
color: string;
background: string;
duration: number;
}
export interface Notify {
(message: NotifyOptions | NotifyMessage): VanNotify;
clear(): void;
setDefaultOptions(options: NotifyOptions): void;
resetDefaultOptions(): void;
}
declare module 'vue/types/vue' {
interface Vue {
$notify: Notify
}
}
export const Notify: Notify;