notice-options.ts 1.8 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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
import { VNode } from 'vue';

export interface NoticeOptions {
    /**
     * 标题
     *
     * @type {string}
     * @memberof NoticeOptions
     */
    title?: string;

    /**
     * 提示信息
     *
     * @type {(string | VNode)}
     * @memberof NoticeOptions
     */
    message?: string | VNode;

    /**
     * 提示类型
     * 默认值:info
     *
     * @type {('success' | 'warning' | 'info' | 'error')}
     * @memberof NoticeOptions
     */
    type?: 'success' | 'warning' | 'info' | 'error';

    /**
     * 自定义弹出位置
     * 默认值:top
     *
     * @type {('top' | 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left')}
     * @memberof NoticeOptions
     */
    position?: 'top' | 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';

    /**
     * 自定义图标的类名,会覆盖type
     *
     * @type {string}
     * @memberof NoticeOptions
     */
    iconClass?: string;

    /**
     * 自定义类名
     *
     * @type {string}
     * @memberof NoticeOptions
     */
    customClass?: string;

    /**
     * 显示时间, 毫秒。设为 0 则不会自动关闭
     * 默认值:3000
     *
     * @type {number}
     * @memberof NoticeOptions
     */
    duration?: number;

    /**
     * 是否显示关闭按钮
     * 默认值:false
     *
     * @type {boolean}
     * @memberof NoticeOptions
     */
    showClose?: boolean;

    /**
     * 是否将 message 属性作为 HTML 片段处理
     * 默认值:false
     *
     * @type {boolean}
     * @memberof NoticeOptions
     */
    dangerouslyUseHTMLString?: boolean;

    /**
     * 关闭时的回调函数, 参数为被关闭的实例
     *
     * @memberof NoticeOptions
     */
    onClose?: () => void;

    /**
     * 自定义偏移量
     *
     * @type {number}
     * @memberof NoticeOptions
     */
    offset?: number
}