24 lines
692 B
TypeScript
Raw Normal View History

2022-03-07 12:33:05 +08:00
import { getLocalStorage } from '@/utils'
2022-03-06 15:19:18 +08:00
import { StorageEnum } from '@/enums/storageEnum'
import { ChartEditStorage } from '@/store/modules/chartEditStore/chartEditStore.d'
export interface ChartEditStorageType extends ChartEditStorage {
id: string
}
2022-03-07 12:33:05 +08:00
export const getLocalStorageInfo = () => {
const urlHash = document.location.hash
const toPathArray = urlHash.split('/')
const id = toPathArray && toPathArray[toPathArray.length - 1]
2022-03-06 15:19:18 +08:00
const storageList: ChartEditStorageType[] = getLocalStorage(
StorageEnum.GO_CHART_STORAGE_LIST
)
for (let i = 0; i < storageList.length; i++) {
if (id.toString() === storageList[i]['id']) {
return storageList[i]
}
}
}