签入版本
This commit is contained in:
@@ -22,6 +22,10 @@ storage.remove('key');
|
||||
storage.clear();
|
||||
```
|
||||
|
||||
:::tip Token 存储约定
|
||||
访问令牌通过 Storage 管理(键名常量 `ACCESS_TOKEN`,实际键 `'ACCESS-TOKEN'`;本项目前端仅存访问令牌)。登出时清除本地存储**并调用** `/api/logout`(服务端吊销 refresh_token,见 [9.8 登录流程](/zh/frontend/login.html))。
|
||||
:::
|
||||
|
||||
## 类型判断
|
||||
|
||||
```typescript
|
||||
@@ -62,8 +66,8 @@ hasSomePermission(['sys:user:add', 'sys:user:update']);
|
||||
```typescript
|
||||
import { formatToDate, formatToDateTime } from '@/utils/dateUtil';
|
||||
|
||||
formatToDate(new Date()); // '2026-09-21'
|
||||
formatToDateTime(new Date()); // '2026-09-21 14:30:00'
|
||||
formatToDate(new Date()); // '2026-10-02'
|
||||
formatToDateTime(new Date()); // '2026-10-02 14:30:00'
|
||||
```
|
||||
|
||||
## 深拷贝
|
||||
@@ -101,4 +105,15 @@ const debouncedSearch = useDebounceFn((keyword: string) => {
|
||||
const throttledScroll = useThrottleFn(() => {
|
||||
handleScroll();
|
||||
}, 200);
|
||||
```
|
||||
```
|
||||
|
||||
## 字典工具
|
||||
|
||||
```typescript
|
||||
import { getDictItemByCode } from '@/api/common/index';
|
||||
|
||||
// 按编码取字典项(下拉框数据源)
|
||||
const options = await getDictItemByCode('example_status');
|
||||
```
|
||||
|
||||
(接口详情见 [5.11 字典配置与使用](/zh/core/dict-guide.html)。)
|
||||
|
||||
Reference in New Issue
Block a user