Closed archorfight closed 6 years ago
/**
@returns */ function resumeObj(o1, o2){ if (o1 == null){ return; } if (o2 == null) { if (typeof (o1) == 'object' && o1 instanceof Array) { o2 = []; } else { o2 = {}; } }
for(var i in o1){ if (o1.hasOwnProperty(i)) { if (typeof(o1[i]) == "object") { o2[i] = resumeObj(o1[i], o2[i]); }else{ o2[i] = o1[i]; } }; }
return o2; }
resumeAll = function(jroll){ var state = history.state; if (state != null){ if (state.htmlSelectors != null){ for (var i = 0; i < state.htmlSelectors.length; i++){ var selector = state.htmlSelectors[i]; if ($(selector).prop("tagName") == 'INPUT'){ $(selector).val(state.html[selector]); }else{ $(selector).html(state.html[selector]); } } }
if (state.attrSelectors != null){
for (var i = 0; i < state.attrSelectors.length; i++){
var selector = state.attrSelectors[i];
$(selector).attr('style', state.attr[selector]);
}
}
resumeObj(state.data, window);
if (jroll != null){
jroll.maxScrollY = __jrollMaxScrollY;
__jrollSrollY = isObjNull(__jrollSrollY) ? 0 : __jrollSrollY;
jroll.options.page = isObjNull(__jrollPage) ? 0 : __jrollPage;
jroll.options.total = isObjNull(__jrollTotal) ? 0 : __jrollTotal;
jroll.scrollTo(0, __jrollSrollY, 0, false);
jroll.refresh();
}
}
}
:astonished: 能把格式对齐一下吗?或者在http://runjs.cn/写个demo
http://runjs.cn/code/75pgp4zn 这个在ios11.3通过缓存加载会无限刷新 http://runjs.cn/code/cerfh831 这种方式又不会。有空看一下为啥吗?
请问作者可以提供一下 解决办法或者 解决思路吗?