diff --git a/src/base/single/tip/tip.toast.js b/src/base/single/tip/tip.toast.js index ffbf2b336..bf00dc014 100644 --- a/src/base/single/tip/tip.toast.js +++ b/src/base/single/tip/tip.toast.js @@ -56,6 +56,9 @@ BI.Toast = BI.inherit(BI.Tip, { case "warning": cls = "toast-warning-font"; break; + case "loading": + cls = "toast-loading-font anim-rotate"; + break; case "normal": default: cls = "toast-message-font"; diff --git a/src/less/base/single/tip/tip.toast.less b/src/less/base/single/tip/tip.toast.less index 875dfa586..4e33930ac 100644 --- a/src/less/base/single/tip/tip.toast.less +++ b/src/less/base/single/tip/tip.toast.less @@ -1,22 +1,27 @@ @import "../../../index.less"; -.bi-toast{ +.bi-toast { color: @color-bi-color-toast-text; line-height: @font-size-16; .border-radius(2px); - &.toast-success{ + + &.toast-success { background: @color-bi-background-toast-success; } - &.toast-warning{ + + &.toast-warning { background: @color-bi-background-toast-warning; } - &.toast-error{ + + &.toast-error { background: @color-bi-background-toast-error; } - &.toast-normal, &.toast-common{ + + &.toast-normal, &.toast-common, &.toast-loading { background: @color-bi-background-toast-normal; } - & .toast-icon{ + + & .toast-icon { font-size: @font-size-16; } } diff --git a/src/less/lib/font.less b/src/less/lib/font.less index d4760ec0e..ce865e30e 100644 --- a/src/less/lib/font.less +++ b/src/less/lib/font.less @@ -51,6 +51,7 @@ @font-tip-success: "e1db"; @font-tip-warning: "e1d7"; @font-tip-message: "e1d9"; +@font-tip-loading: "e7cd"; @font-key: "e1d0"; diff --git a/src/less/resource/font.less b/src/less/resource/font.less index a6551f864..be6730eca 100644 --- a/src/less/resource/font.less +++ b/src/less/resource/font.less @@ -86,6 +86,7 @@ .font(toast-success-font, @font-tip-success, @color-bi-color-toast-success); .font(toast-warning-font, @font-tip-warning, @color-bi-color-toast-warning); .font(toast-message-font, @font-tip-message, @color-bi-color-toast-normal); +.font(toast-loading-font, @font-tip-loading, @color-bi-color-toast-normal); //数值区间 .font(less-font, @font-less); diff --git a/typescript/base/foundation/message.ts b/typescript/base/foundation/message.ts index 63790d1cb..e1506c35a 100644 --- a/typescript/base/foundation/message.ts +++ b/typescript/base/foundation/message.ts @@ -1,6 +1,12 @@ +type toastOptions = { + level: "success" | "warning" | "error" | "normal" | "loading" + autoClose?: boolean + callback?: Function +} + export type _msg = { - alert: (title: string, message?: string | {[key: string]: any}, callback?: (result?: boolean)=>void) => void - confirm: (title: string, message?: string | {[key: string]: any}, callback?: (result: boolean)=>void) => void - prompt: (title: string, message?: string, value?: any, callback?: (result: string) => void, minWidth?: number) => void - toast: (message: string, options?: object | string, context?: HTMLElement) => void + alert: (title: string, message?: string | { [key: string]: any }, callback?: (result?: boolean) => void) => void + confirm: (title: string, message?: string | { [key: string]: any }, callback?: (result: boolean) => void) => void + prompt: (title: string, message?: string, value?: any, callback?: (result: string) => void, minWidth?: number) => void + toast: (message: string | Obj, options?: toastOptions | string, context?: HTMLElement) => void }