# 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端錯誤提示界面如下:
wap端錯誤提示界面

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");
```
效果圖:

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");
```
