1 Star 0 Fork 0

SirXue/AlertMsgH5

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
build
src
css
icon
lib
README.md
index.js
package.json
.gitignore
index.html
package-lock.json
package.json
test.html
test.js
webpack.config.js
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

欢迎使用AlertMsgH5

AlertMsgH5是一套轻量级的消息提示组件库,不依赖任何视图框架,纯js编写,开箱即用 项目依赖浏览器,不可脱离window环境,因为组件都是直接挂载到window上边的,一处挂载,全局使用 本组件适合于一些封装库、或者不需要大量使用UI却需要进行消息提示的项目使用 组件库 提供alert消息提示、confirm消息确认、notification通知提示三种组件 原生开发请前往仓库使用打包后的文件,npm下载使用,请确保您的项目使用了css-loader和style-loader来处理css,


在线预览

git仓库 gitee仓库

Alert

分开传参

方法 参数
info content: string -->提示内容
delay: number -->关闭延迟,默认3秒
success content: string -->提示内容
delay: number -->关闭延迟,默认3秒
warning content: string -->提示内容
delay: number -->关闭延迟,默认3秒
error content: string -->提示内容
delay: number -->关闭延迟,默认3秒
plian content: string -->提示内容
delay: number -->关闭延迟,默认3秒

示例

import { creatMSG } from "alertmsgh5"
creatMSG("$ALERTMSG")  //挂载组件到window上(默认传参“$ALERTMSG")
console.log(window)
const {info, success, warning, error, plain} = $ALERTMSG.alert
info("消息提示", 3000)
success("成功提示", 3000)

Notification

对象传参

方法 参数
info title: string -->标题
content: string -->提示内容
delay: number -->关闭延迟,默认3秒
success title: string -->标题
content: string -->提示内容
delay: number -->关闭延迟,默认3秒
warning title: string -->标题
content: string -->提示内容
delay: number -->关闭延迟,默认3秒
error title: string -->标题
content: string -->提示内容
delay: number -->关闭延迟,默认3秒
plian title: string -->标题
content: string -->提示内容
delay: number -->关闭延迟,默认3秒

示例

import { creatMSG } from "alertmsgh5"
creatMSG("$ALERTMSG")  //挂载组件到window上(默认传参“$ALERTMSG")

const {info, success, warning, error, plain} = $ALERTMSG.notification
info({
	title: "系统提示",
	content: "这是系统提示",
	delay: 3000
})
success({
	title: "系统提示",
	content: "这是成功提示",
	delay: 3000
})

Confirm

对象传参

方法 参数
open mask: boolean -->是否打开遮罩
content: string -->提示内容,支持html字符串
btnOK: string -->确认按钮文字
btnCancel: string -->取消按钮文字
OKFun: function -->确定的回调
CancelFun: function -->取消的回调

示例

import { creatMSG } from "alertmsgh5"
creatMSG("$ALERTMSG")  //挂载组件到window上(默认传参“$ALERTMSG")

const { open } = $ALERTMSG.confirm
open({
	mask: true,
	content: "确定继续进行吗?",
	btnOK: "确定",
	btnCancel: "取消",
	OKFun: () => {},
	CancelFun: () => {}
})

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/post-man/alert-msg-h5.git
git@gitee.com:post-man/alert-msg-h5.git
post-man
alert-msg-h5
AlertMsgH5
main

搜索帮助