1.1.2 • Published 3 years ago

@redbuck/notification v1.1.2

Weekly downloads
4
License
ISC
Repository
-
Last release
3 years ago

@redbuck/notification

简介

一个简单的弹窗提示组件

使用

import Notification from "@redbuck/notification";

var win = new Notification({
  title: '标题',
  content: `
      <div>
        <p>hello notification</p>
      </div>
    `,
  duration: 0
});

win.show();

参数

enum Position {
  "top-left" = "top-left",
  "top-center" = "top-center",
  "top-right" = "top-right",
  "center-left" = "center-left",
  "center-center" = "center-center",
  "center-right" = "center-right",
  "bottom-left" = "bottom-left",
  "bottom-center" = "bottom-center",
  "bottom-right" = "bottom-right",
}

type Option = {
  container: HTMLElement; // 父容器
  constrain: HTMLElement; // 约束范围
  duration: number; // 显示时间
  draggable: boolean; // 是否可拖拽
  title: string;
  content: string;
  closeable: boolean;
  namespace: string;
  position: Position;
  style: string;
  maxCount: number; // 同位置最大显示数量
  distance: number; // 同位置距离
};