comfun.js
797 Bytes
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
34
35
36
37
import inter from 'comenter'
function cache(key,value){
if(value){
wx.setStorageSync(key,value);
}
return wx.getStorageSync(key);
};
function setBarTitle(title){
wx.setNavigationBarTitle({
title:title
})
};
function request(url,data){
var obj={};
wx.request({
url:url, //仅为示例,并非真实的接口地址
method:'POST',
data: data,
header: {
'content-type': 'application/x-www-form-urlencoded'
},
success:function(res) {
obj.result='success';
obj.jsondata=res.data;
return obj;
},
fail:function(){
obj.result='fail';
return obj;
}
})
}
module.exports = {
cache,
setBarTitle,
request
}