export default { getSetting:function(){ let settingstr=uni.getStorageSync('$settings'); //不存在时是空串 //console.log(settingstr.length); return settingstr?JSON.parse(settingstr):null; }, setSetting:function(setting){ setting = setting || {}; uni.setStorageSync('$settings', JSON.stringify(setting)); }, addSetting:function(setting){ let settingObj=this.getSetting()||{}; this.extend(settingObj,setting); this.setSetting(settingObj); }, putSetting:function(key,val){ let settingObj=this.getSetting()||{}; settingObj[key]=val; this.setSetting(settingObj); }, takeSetting:function(key){ let setting=this.getSetting()||{}; return setting[key]; }, clearSetting:function(){ uni.clearStorageSync(); }, extend:function(srcObj,refObj){ for(let attr in refObj){ srcObj[attr]=refObj[attr]; } }, setPullRefresh:function(supportIf){ const pages=getCurrentPages(); const page=pages[pages.length-1]; const currentWebview=page.$getAppWebview(); currentWebview.setPullToRefresh({support:supportIf}) }, getURLParams:function(){ //console.log(location) let urlParam=location.search.substr(1) //console.log(urlParam) if(!urlParam||urlParam.length==0){ //hash路由模式 urlParam=location.hash?location.hash.substr(location.hash.lastIndexOf('?')+1):'' } let str=urlParam.split("&") let param={},entity=null; for(let i=0,len=str.length;i