https://github.com/gitguanqi/xqmsg
This is a js show message tip plugin.
https://github.com/gitguanqi/xqmsg
javascript msg
Last synced: 9 months ago
JSON representation
This is a js show message tip plugin.
- Host: GitHub
- URL: https://github.com/gitguanqi/xqmsg
- Owner: gitguanqi
- License: mit
- Created: 2022-10-02T13:46:29.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-13T10:13:23.000Z (about 2 years ago)
- Last Synced: 2025-06-08T21:13:13.739Z (10 months ago)
- Topics: javascript, msg
- Language: JavaScript
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# xqmsg
This is a js show message tip plugin.
[View Chinese documents](./zh.md)
## Install
**Browser**:
import cdn
```html
import xqmsg from '../lib/js/xqmsg-esm.min.js';
```
## Usage
+ html
```html
1. pop
success
error
warning
info
2.msg
top
middle
bottom
3.confirm
confirm
```
+ call
```js
// 1. pop
let popBtn = document.querySelectorAll('.popBtn');
for (let i = 0; i < popBtn.length; i++) {
const item = popBtn[i];
item.addEventListener('click', popSet, false);
}
function popSet (event) {
let e = event || window.event;
let params = e.target.dataset;
xqmsg.pop(params.text, params.type);
}
// 2.msg
let msgBtn = document.querySelectorAll('.msgBtn');
for (let i = 0; i < msgBtn.length; i++) {
const item = msgBtn[i];
item.addEventListener('click', msgSet, false);
}
function msgSet (event) {
let e = event || window.event;
let params = e.target.dataset;
xqmsg.msg(params.text, params.type);
}
// 3.confirm
let confirmBtn = document.querySelector('.confirmBtn');
confirmBtn.addEventListener('click', confirmSet, false);
async function confirmSet () {
let res = await xqmsg.confirm('You want to leave me?');
console.log(res);
// {type: 1, msg: 'confirm'}
// {type: 2, msg: 'cancel'}
}
```
## View xqmsg
Run this script to view the demonstration case: `npm run test:browser`.
+ [demo](https://xqgj.cc/xqmsg/test/browser.html)
## ask questions
[submit your question](https://github.com/gitguanqi/xqmsg/issues/new)
## Author
[@gitguanqi](https://github.com/gitguanqi)