# Niushop开源商城错误提示
---
web端错误提示文件在:template/web/default/index/error.html
使用方法:
```javascript
if(window.sessionStorage){
sessionStorage.setItem('errorMsg', JSON.stringify({title : '您刷新过于频繁,请稍后再试', message : '消息提示'}));
}
location.href = "{:__URL('APP_MAIN/index/errorTemplate')}";
```
web端错误提示界面如下:![](https://img.kancloud.cn/2d/03/2d03c9d49c119652f52b5677250e16ba_939x393.png)
wap端错误提示界面
![](/assets/error_tip_wap.png)
web端消息提示在common.js里
代码如下:
```javascript
//消息弹出框,因为每次都是重新new的,所以会弹出多次
function show(m, o) {
if (o == null) o = {placement: 'center'};
if (zui_message == null) {
zui_message = new $.zui.Messager(o);
}
zui_message.show(m);
}
```
使用方法:
```javascript
show("Hello NiuShop");
```
效果图:
![](https://img.kancloud.cn/9f/80/9f80ce1e3757833b766ffe650c61818e_178x60.png)
wap端消息提示在common.js中
代码如下:
```javascript
function toast(msg, url, duration) {
var type = 'info';
if (duration == undefined || duration == "") duration = "long";
if (url) {
setTimeout(function () {
location.href = url;
}, 1000);
}
new $.Display({
display: 'messager',
autoHide: 1500,
placement: "center",
closeButton: false
}).show({
content: msg,
type: type,
});
}
```
使用方法:
```javascript
toast("Hello NiuShop");
```
![](https://img.kancloud.cn/27/fc/27fc4b2d7d4464963b6858c59e950d32_137x73.png)