mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(projects): 菜单数据及组件接入
This commit is contained in:
@ -1,2 +1,2 @@
|
||||
export { getToken, setToken, getUserInfo, getLoginModuleRegExp } from './user';
|
||||
export { getToken, setToken, removeToken, getUserInfo, getLoginModuleRegExp } from './user';
|
||||
export { getLoginRedirectUrl, toLoginRedirectUrl, toHomeByLocation } from './location';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { EnumStorageKey } from '@/enum';
|
||||
import type { LoginModuleType } from '@/interface';
|
||||
import { setLocal, getLocal } from '../storage';
|
||||
import { setLocal, getLocal, removeLocal } from '../storage';
|
||||
|
||||
/** 设置token */
|
||||
export function getToken() {
|
||||
@ -12,6 +12,10 @@ export function setToken(token: string) {
|
||||
setLocal(EnumStorageKey.token, token);
|
||||
}
|
||||
|
||||
export function removeToken() {
|
||||
removeLocal(EnumStorageKey.token);
|
||||
}
|
||||
|
||||
export function getUserInfo() {}
|
||||
|
||||
/** 获取登录模块的正则字符串 */
|
||||
|
12
src/utils/common/icon.ts
Normal file
12
src/utils/common/icon.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { h } from 'vue';
|
||||
import type { Component } from 'vue';
|
||||
import { NIcon } from 'naive-ui';
|
||||
|
||||
/** 动态渲染vicon */
|
||||
export function dynamicIconRender(icon: Component) {
|
||||
return () => {
|
||||
return h(NIcon, null, {
|
||||
default: () => h(icon)
|
||||
});
|
||||
};
|
||||
}
|
@ -13,3 +13,5 @@ export {
|
||||
} from './typeof';
|
||||
|
||||
export { brightenColor, darkenColor } from './color';
|
||||
|
||||
export { dynamicIconRender } from './icon';
|
||||
|
@ -1,6 +1,7 @@
|
||||
export {
|
||||
setToken,
|
||||
getToken,
|
||||
removeToken,
|
||||
getUserInfo,
|
||||
getLoginModuleRegExp,
|
||||
getLoginRedirectUrl,
|
||||
@ -21,7 +22,8 @@ export {
|
||||
isSet,
|
||||
isMap,
|
||||
brightenColor,
|
||||
darkenColor
|
||||
darkenColor,
|
||||
dynamicIconRender
|
||||
} from './common';
|
||||
|
||||
export { setLocal, getLocal, setSession, getSession } from './storage';
|
||||
|
@ -1,2 +1,2 @@
|
||||
export { setLocal, getLocal } from './local';
|
||||
export { setLocal, getLocal, removeLocal } from './local';
|
||||
export { setSession, getSession } from './session';
|
||||
|
@ -1,12 +1,16 @@
|
||||
export function setLocal(key: string, value: unknown) {
|
||||
const json = JSON.stringify(value);
|
||||
localStorage.setItem(key, json);
|
||||
window.localStorage.setItem(key, json);
|
||||
}
|
||||
|
||||
export function getLocal<T>(key: string) {
|
||||
const json = localStorage.getItem(key);
|
||||
const json = window.localStorage.getItem(key);
|
||||
if (json) {
|
||||
return JSON.parse(json) as T;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
export function removeLocal(key: string) {
|
||||
window.localStorage.removeItem(key);
|
||||
}
|
||||
|
Reference in New Issue
Block a user