update
This commit is contained in:
@ -30,26 +30,6 @@ const convertToDashedString = (input: string): string => {
|
||||
return `/${parts.join('-')}`;
|
||||
}
|
||||
|
||||
// export const convertRouteToMenu = (data: RouteRecordRaw[], basePath: string = '/home', iconIndex: number = 0): MenuItemModel[] => {
|
||||
// return data.filter((i) => i.path !== '').map((item) => {
|
||||
// const convertedItem: MenuItemModel = {
|
||||
// name: item.name?.toString() || '',
|
||||
// path: convertToDashedString(`${basePath}/${item.path}`).replace('/home-', '/home/'),
|
||||
// expanded: false,
|
||||
// icon: undefined,
|
||||
// children: [],
|
||||
// };
|
||||
|
||||
// if (item.children) {
|
||||
// convertedItem.icon = navigationIcon[iconIndex];
|
||||
// iconIndex = (iconIndex + 1) % navigationIcon.length;
|
||||
// convertedItem.children = convertRouteToMenu(item.children, `${basePath}/${item.path}`, iconIndex);
|
||||
// }
|
||||
|
||||
// return convertedItem
|
||||
// })
|
||||
// }
|
||||
|
||||
export const convertRouteToMenu = (data: RouteRecordRaw[], basePath: string = '/home', iconIndex: number = 0): MenuItemModel[] => {
|
||||
return data.filter((i) => i.path !== '').map((item) => {
|
||||
const convertedItem: MenuItemModel = {
|
||||
|
28
src/utils/storage.ts
Normal file
28
src/utils/storage.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import { EncryptStorage } from 'encrypt-storage'
|
||||
const encryptStorage = new EncryptStorage('qwertyuiopasdfghjklzxcvbnm-1234567890')
|
||||
|
||||
const writeData = (key: string, data: any) => encryptStorage.setItem(key, data)
|
||||
const writeDataJson = (key: string, data: any) => encryptStorage.setItem(key, JSON.stringify(data))
|
||||
const removeData = (key: string) => encryptStorage.removeItem(key)
|
||||
const readData = (key: string) => {
|
||||
try {
|
||||
return encryptStorage.getItem(key)
|
||||
} catch (error) {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
const readDataJson = (key: string) => {
|
||||
try {
|
||||
return encryptStorage.getItem(key)
|
||||
} catch (error) {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
removeData,
|
||||
writeData,
|
||||
writeDataJson,
|
||||
readData,
|
||||
readDataJson
|
||||
}
|
Reference in New Issue
Block a user