常用方法

request 网络请求

/*
*参数项说明
*
*@param c 参数项
**param data 发送数据项,一般为shiyu2参数,如果没有可不传。 JSON
**param containFile 发送的数据是否包含文件,如果为真则数据会有不同的处理
**param loadTxt loading提示词。 string。 加载中。
**param debug 是否开启调试模式。 number。 0。 0 - 随全局调试走 | 1 - 强制开启调试
**param success 请求成功即 state==success 时回调。 function
**param fail 请求失败即 state==fail 时回调。 function
**param complete 请求完成回调,无论请求成功还是失败。 function
*/

/*
*发起请求处理
*
*@param c 参数项。 JSON
*/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

sl_request({
url:'',
data:'',
loading:true,
loadTxt:'加载中'
json:true,

// // 成功回调
// success(res){
// console.log(res);
// $sy.tip.change({
// state: "success",
// txt: "查询成功",
// hide: true,
// time: 1024,
// });
// },

// // 失败回调
// fail(err){
// console.log(err)
// },

// 无论成功还是失败都会回调
complete(){
if(res.code == '1000'){

}else if(res.code == '1003'){

}
}
})

Tips 弹窗

参数说明:
第一个参数为对象,type为下方按钮数量 可选项 one/two string
txt为弹窗内容 string
hide为显示隐藏 可选项 true/false bool
time为弹窗消失时间
第二个参数为点击确认的回调函数
第三个参数为点击取消的回调函数

1
2
3
4
5
6
7
8
var c = new $sy.notice({
type: 'two',
txt: '是否确认删除',
hide: true,
time: 1024
}, function () {
c.hide();
}, function () {});

改变弹窗内容

1
2
3
4
5
6
7
$sy.tip.change({
state: "success",
txt: "查询成功",
hide: true,
time: 1024,
});