彈窗插件使用的是Layer For Mobile
官網文檔地址是:[https://layer.layui.com/mobile/](https://layer.layui.com/mobile/)
```
/** 以下是小試牛刀的調用代碼(此處不展示事件綁定)*/
//信息框
layer.open({
content: '移動版和PC版不能同時存在同一頁面'
,btn: '我知道了'
});
//提示
layer.open({
content: 'hello layer'
,skin: 'msg'
,time: 2 //2秒后自動關閉
});
//詢問框
layer.open({
content: '您確定要刷新一下本頁面嗎?'
,btn: ['刷新', '不要']
,yes: function(index){
location.reload();
layer.close(index);
}
});
//底部對話框
layer.open({
content: '這是一個底部彈出的詢問提示'
,btn: ['刪除', '取消']
,skin: 'footer'
,yes: function(index){
layer.open({content: '執行刪除操作'})
}
});
//底部提示
layer.open({
content: '一個沒有任何按鈕的底部提示'
,skin: 'footer'
});
//自定義標題風格
layer.open({
title: [
'我是標題',
'background-color: #FF4351; color:#fff;'
]
,content: '標題風格任你定義。'
});
//頁面層
layer.open({
type: 1
,content: '可傳入任何內容,支持html。一般用于手機頁面中'
,anim: 'up'
,style: 'position:fixed; bottom:0; left:0; width: 100%; height: 200px; padding:10px 0; border:none;'
});
//loading層
layer.open({type: 2});
//loading帶文字
layer.open({
type: 2
,content: '加載中'
});
```
### 其他方法
```
layer.v
```
返回當前使用的layer mobile版本號
```
layer.close(index)
```
用于關閉特定層,index為該特定層的索引
```
layer.closeAll()
```
關閉頁面所有layer的層