Vue -- element-ui el-table 点击tr项页面跳转,返回后缓存回显点击项

页面跳转反显

点击table tr项后,页面跳转到下级页面,返回回显搜索条件、当前页码、并将点击项select选中、滚动条也被记录回显跳转时滚动的位置

思路:

  1. 页面临时缓存我选择使用sessionStorage,点击tr行将搜索条件和页码,点击行的id进行存储
data(){
    return {
        
    }
}
setSessionStore (name, content) {
                if (!name) return
                if (typeof content !== 'string') {
                content = JSON.stringify(content)
                }
                window.sessionStorage.setItem(name, content)
            },
            getSessionStore (name) {
                if (!name) return;
                var content = window.sessionStorage.getItem(name);
                if (typeof content == 'string') {
                    content = JSON.parse(content)
                }
                return content;
            },
            removeSessionStore (name) {
                if (!name) return
                return window.sessionStorage.removeItem(name)
            }
  1. 进入页面取出sessionStorage,在init请求返回值后,进行table选中、分页回显

猜你喜欢

转载自www.cnblogs.com/lisaShare/p/11025872.html