Newer
Older
xc-metering-front / src / utils / keepQuery.ts
lyg on 28 Mar 2024 559 bytes 受检需求修改
// 保存页面查询等参数
import useKeepAliveStore from '@/store/modules/keepAlive'

const keepAliveStore = useKeepAliveStore()
// 操作
const needKeep = ['edit', 'detail', 'update', 'add', 'create', 'trainPlanApprove', 'solveDetail', 'certPrintDetail']
export function keepSearchParams(to: any, componentName: string) {
  if (needKeep.some((item: string) => to.includes(item))) {
    keepAliveStore.add(componentName)
    console.log(keepAliveStore.list)
  }
  else {
    keepAliveStore.remove(componentName)
    console.log(keepAliveStore.list)
  }
}