function h5App(){
this.setItem = function(key,val){
var str = JSON.stringify(val)
localStorage.setItem(key,str);
}
this.getItem = function(key){
if (key == ‘‘ || key == undefined) {
key = "produstList";
}
this.clear = function(){
localStorage.clear();
}
//多个参数
this.get_url = function (key){
// 获取参数
var url = window.location.search;
// 正则筛选地址栏
var reg = new RegExp("(^|&)"+ key +"=([^&]*)(&|$)");
// 匹配目标参数
var result = url.substr(1).match(reg);
//返回参数值
return result ? decodeURIComponent(result[2]) : null;
};
//+------
}
//持续更新
时间: 2024-10-24 03:58:19