message-util.ts 1.0 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
import Vue from 'vue';
import { IMessageUtil } from '@ibiz-template/runtime';
import { Message } from 'view-design';

/**
 * 消息通知
 *
 * @author chitanda
 * @date 2022-08-17 16:08:24
 * @export
 * @class MessageUtil
 * @implements {IMessageUtil}
 */
export class MessageUtil implements IMessageUtil {
  protected util: Message = Vue.prototype.$Message;

  info(
    msg: string,
    duration?: number | undefined,
    closable?: boolean | undefined,
  ): void {
    this.util.info({ content: msg, duration, closable });
  }

  success(
    msg: string,
    duration?: number | undefined,
    closable?: boolean | undefined,
  ): void {
    this.util.success({ content: msg, duration, closable });
  }

  warning(
    msg: string,
    duration?: number | undefined,
    closable?: boolean | undefined,
  ): void {
    this.util.warning({ content: msg, duration, closable });
  }

  error(
    msg: string,
    duration?: number | undefined,
    closable?: boolean | undefined,
  ): void {
    this.util.error({ content: msg, duration, closable });
  }
}