@academy-ui/notification 中文文档教程

发布于 6年前 浏览 24 更新于 3年前

Notification Controller

通知样式 UI 的 Web 组件实现。 灵感来自 Firebase 的通知样式。

Image

Implementation

Using Locally

  • npm install @academy-ui/notification --save
  • Put a script tag similar to this <script src='node_modules/@academy-ui/notification/dist/notification-controller.js'></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc

Using a CDN

  • Put a script tag similar to this <script src='https://unpkg.com/@academy-ui/notification@1.0.3/dist/notification-controller.js'></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc

注意:对于所有实现,您需要在根 中包含 notification-controller >index.html 您的项目。

<notification-controller class="top-right"></notification-controller>

可用的样式放置类包括:

  • top-left
  • top-right
  • top-center
  • bottom-left
  • bottom-right
  • bottom-center

Usage

Success Messages

document.getElementsByTagName('notification-controller').item(0).success('This is a success alert.');

Error Messages

document.getElementsByTagName('notification-controller').item(0).error('This is an error alert.');

Warning Messages

document.getElementsByTagName('notification-controller').item(0).warning('This is a warning alert.');

Info Messages

document.getElementsByTagName('notification-controller').item(0).error('This is an info alert.');

注意:您可以传递完整的选项配置而不是字符串消息来控制其他属性,例如图标、持续时间、单独的通知动画等。

Notification Controller

Web component implementation of a notification styled UI. Inspired around Firebase's notification styling.

Image

Implementation

Using Locally

  • npm install @academy-ui/notification --save
  • Put a script tag similar to this <script src='node_modules/@academy-ui/notification/dist/notification-controller.js'></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc

Using a CDN

  • Put a script tag similar to this <script src='https://unpkg.com/@academy-ui/notification@1.0.3/dist/notification-controller.js'></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc

Note: For all implementations you need to include the notification-controller in the root index.html of your project.

<notification-controller class="top-right"></notification-controller>

Available styling placement classes include:

  • top-left
  • top-right
  • top-center
  • bottom-left
  • bottom-right
  • bottom-center

Usage

Success Messages

document.getElementsByTagName('notification-controller').item(0).success('This is a success alert.');

Error Messages

document.getElementsByTagName('notification-controller').item(0).error('This is an error alert.');

Warning Messages

document.getElementsByTagName('notification-controller').item(0).warning('This is a warning alert.');

Info Messages

document.getElementsByTagName('notification-controller').item(0).error('This is an info alert.');

Note: You can pass the full options config instead of a string message to control other properties such as icons, durations, individual notification animations, etc.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文