if (window.performance) { //回退的type ==2
if(window.performance.navigation.type == 2){
let sessionObj = JSON.parse(sessionStorage.getItem('selectParams')) //如果有历史记录
if(sessionObj){
form.val("search",sessionObj); //放入form
}
}
}
var selectParams; //搜索的参数存起来
form.on('submit(fromQuery)', function (data) {
table.reload('product', {
page:{curr: 1}
,where: data.field
});
form.render();
selectParams = data.field //搜索赋值
});
//跳转存session
table.on('tool(product)', function(obj){
var layEvent = obj.event; //获得 lay-event 对应的值
if(layEvent === 'queryDetailLook'){
let objStr = JSON.stringify(selectParams)
sessionStorage.setItem('selectParams',[objStr])
}
});
<script type="text/html" id="detail_url">
<!--href="/home/standard_product.product/product_detail?itemid={{d.itemid}}" -->
<a class="_a" target="_self" href="/home/standard_product.product/product_detail?itemid={{d.itemid}}" lay-event="queryDetailLook">查看</a>
</script>