Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
TheWindRises-2 authored Jul 31, 2022
1 parent 79ae6d1 commit fc9576a
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

coco-message 是一个简单实用的javascript信息提示插件, 兼容主流浏览器,兼容至ie9 (ie没有svg动画)

1.0.5以后改为白色背景


## Usage

Expand All @@ -16,12 +16,22 @@ cnpm install coco-message -S
```
import cocoMessage from 'coco-message'
cocoMessage('hello world')
or
cocoMessage.info('hello world')
```

```
<script src="https://unpkg.com/coco-message/coco-message.min.js"></script>
```
## 暗黑模式

```
<html class="dark">
在html标签上添加dark样式名即可
```

## Examples


Expand All @@ -34,13 +44,20 @@ cocoMessage.info('hello world')
对参数没有顺序要求,cocoMessage会根据参数的数据类型进行解析

```javascript
cocoMessage.config({
duration: 10000,
cocoMessage.config({ //全局配置
duration: 10000, //消息显示时长
});

cocoMessage.info(3000, "请先登录!", function () {
console.log("close");
});
const close = cocoMessage.info(
"请先登录!", //消息文本
3000, //消息显示时长
()=> { //回调函数
console.log("close");
}
);

close(); //关闭消息方法


var div = document.createElement("div");
div.innerText = "修改成功!";
Expand Down

0 comments on commit fc9576a

Please sign in to comment.