Newer
Older
xc-business-system / src / utils / keepQuery.ts
dutingting on 28 Mar 2024 533 bytes 新需求、bug修复
// 保存页面查询等参数
import useKeepAliveStore from '@/store/modules/keepAlive'

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