Skip to content

Commit

Permalink
fix(types): update type declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
xxyan0205 committed Jul 31, 2018
1 parent 3ed363e commit c09dd9a
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
15 changes: 15 additions & 0 deletions components/image-reader/image-processor.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export interface ImageProcessorOptions {
dataUrl: string
width?: number
height?: number
quality: number
}

export interface ImageProcessorData {
dataUrl: string
blob: Blob
}

export default function ImageProcessor(
options: ImageProcessorOptions,
callback?: (data: ImageProcessorData) => any): Promise<ImageProcessorData>
7 changes: 7 additions & 0 deletions types/action-sheet.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@ export type ActionSheetCreateOptions = {
}

export interface ActionSheet {
(options?: ActionSheetCreateOptions): void
create(options: ActionSheetCreateOptions): Vue
closeAll(): void
destroyAll(): void
}

declare module 'vue/types/vue' {
interface Vue {
$sheet: ActionSheet
}
}

export const ActionSheet: ActionSheet
7 changes: 7 additions & 0 deletions types/dialog.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,18 @@ export type DialogSucceedOptions = {
export type DialogFailedOptions = DialogSucceedOptions

export interface Dialog {
(options?: ToastConstructorOptions): void
confirm(options: DialogConfirmOptions): Vue
alert(options: DialogAlertOptions): Vue
succeed(options: DialogSucceedOptions): Vue
failed(options: DialogFailedOptions): Vue
closeAll(): void
}

declare module 'vue/types/vue' {
interface Vue {
$dialog: Dialog
}
}

export const Dialog: Dialog
6 changes: 3 additions & 3 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import Vue from 'vue'
import { MandComponent } from './component'
import { Toast } from './toast'
import imageProcessor from './image-processor'
import { Dialog } from './dialog'
import { ActionSheet } from './action-sheet'

export function install(vue: typeof Vue): void

export class ActivityIndicator extends MandComponent { }
export class Amount extends MandComponent { }
export class ActionBar extends MandComponent { }
export class ActionSheet extends MandComponent { }
export class Agree extends MandComponent { }
export class Button extends MandComponent { }
export class Captcha extends MandComponent { }
Expand Down Expand Up @@ -62,5 +61,6 @@ export class Tip extends MandComponent { }

export {
Toast,
Dialog
Dialog,
ActionSheet
}
6 changes: 6 additions & 0 deletions types/toast.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,10 @@ export interface Toast {
hide(): void
}

declare module 'vue/types/vue' {
interface Vue {
$toast: Toast
}
}

export const Toast: Toast

0 comments on commit c09dd9a

Please sign in to comment.