百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
N

notie

> 编程语言
开源

JavaScript 的一个干净简洁的通知、输入和选择套件,无任何依赖

6.3K stars0 点赞1 次浏览
访问官网GitHub

工具介绍

JavaScript 的一个干净简洁的通知、输入和选择套件,无任何依赖

notie

notie 是一个简洁干净的 JavaScript 通知、输入和选择套件,无任何依赖

在线演示:https://jaredreich.com/notie

使用 notie 你可以:

  • 提醒用户
  • 确认用户的选择
  • 允许用户输入信息
  • 允许用户选择选项
  • 允许用户选择日期

特性

  • 纯 JavaScript,无依赖,使用 ES6 编写
  • 轻松自定义
  • 可更改颜色以匹配你的风格/品牌
  • 通过 sass 文件(notie.scss)修改样式,或直接覆盖 CSS
  • 字体大小根据屏幕尺寸自动调整

浏览器支持

  • IE 10+
  • Chrome 11+
  • Firefox 4+
  • Safari 5.1+
  • Opera 11.5+

安装

HTML:

xml
<head>
  ...
  <link rel="stylesheet" type="text/css" href="https://unpkg.com/notie/dist/notie.min.css">
  <style>
    /* override styles here */
    .notie-container {
      box-shadow: none;
    }
  </style>
</head>
<body>
  ...
  
  <script src="https://unpkg.com/notie"></script>
</body>

npm:

bash
npm install notie

用法

ES6:

javascript
import notie from 'notie'
// or
import { alert, force, confirm, input, select, date, setOptions, hideAlerts } from 'notie'

浏览器:

javascript
notie
// or
window.notie

可用方法:

…

例如:

…

使用 ES6 可以获得更优雅的代码并继承 this:

javascript
notie.confirm({
  text: 'Leave the page?',
  submitCallback: () => this.location.href = 'https://google.com'
})

notie.confirm({
  text: 'Is ES6 great?',
  cancelCallback: () => notie.alert({ type: 3, text: 'Why not?' }),
  submitCallback: () => notie.alert({ type: 1, text: 'I Agree' })
})

notie.force({
  type: 3,
  text: 'You cannot do that, sending you back.',
  buttonText: 'OK',
  callback: () => notie.alert({ type: 3, text: 'Maybe when you\'re older...' })
})

自定义样式

SASS:

scss
// 在导入 notie 之前:
$notie-color-success: #57BF57;
$notie-color-warning: #D6A14D;
$notie-color-error: #E1715B;
$notie-color-info: #4D82D6;
$notie-color-neutral: #A0A0A0;
// 所有可覆盖的变量请参见 src/notie.scss

// 然后导入 notie:
@import '../../node_modules/notie/src/notie';

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

JavaScriptalertconfirmgrowlinput

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言