fix:回退保留状态弃用window,使用store

This commit is contained in:
liuhonghong
2022-11-11 15:17:44 +08:00
parent 323ccae196
commit c322059c97
4 changed files with 18 additions and 10 deletions

View File

@@ -1198,6 +1198,7 @@ export default {
*/
beforeRouterPush () {
const currentRouter = this.$_.cloneDeep(this.$route.query)
const historyList = this.$_.cloneDeep(this.$store.getters.getRouterHistoryList)
const tempObj = {
t: currentRouter.t,
@@ -1205,21 +1206,22 @@ export default {
path: this.$_.cloneDeep(this.$route.path),
params: this.$_.cloneDeep(this.$route.params)
}
if (window.localRouterHistoryList.length > 0) {
if (historyList.length > 0) {
let flag = true
window.localRouterHistoryList.forEach((item, index) => {
historyList.forEach((item, index) => {
if (item.t === currentRouter.t) {
window.localRouterHistoryList[index] = tempObj
historyList[index] = tempObj
flag = false
}
if (!flag) {
return true
}
})
if (flag) window.localRouterHistoryList.push(tempObj)
if (flag) historyList.push(tempObj)
} else {
window.localRouterHistoryList.push(tempObj)
historyList.push(tempObj)
}
this.$store.commit('setRouterHistoryList', historyList)
},
handleSearchParams (columnValue) {
columnValue = columnValue.replaceAll("'", "\\\\'")