Skip to content

Commit

Permalink
feat: 新增菜单(文件预览)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangshigui committed Sep 13, 2024
1 parent aa66854 commit 209ca56
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ pnpm run build
- 表格
- 大屏
- 流程图
- 文件预览

## 功能及 UI 参考

Expand Down
11 changes: 10 additions & 1 deletion src/config/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: liuhua
* @Date: 2023-06-17 17:23:30
* @LastEditors: zhangshigui
* @LastEditTime: 2024-07-22 11:41:57
* @LastEditTime: 2024-09-13 15:32:49
* @Description: 菜单配置(配置由后端返回更加灵活)
*
*/
Expand Down Expand Up @@ -170,5 +170,14 @@ export const menu: MenuItem[] = [
icon: 'StockOutlined',
roles: ['admin', 'test'],
parentId: null
},
// 文件预览
{
id: '9',
title: '文件预览',
path: '/file',
icon: 'FileTextOutlined',
roles: ['admin', 'test'],
parentId: null
}
];
15 changes: 8 additions & 7 deletions src/router/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import { lazy, ReactNode, Suspense } from 'react';
import {
Route,
Routes,
useLocation,
Navigate,
type RouteObject
} from 'react-router-dom';
import { Route, Routes, useLocation, Navigate, type RouteObject } from 'react-router-dom';
import { getToken } from '@/utils/store';
import { Spin } from 'antd';
// Layout不需要懒加载
Expand All @@ -31,6 +25,8 @@ const DragTable = lazy(() => import('@/views/table/darg-table'));
const ScreenCity = lazy(() => import('@/views/screen/city'));
// process
const Process = lazy(() => import('@/views/process'));
// file
const File = lazy(() => import('@/views/file'));

// 避免闪屏
const lazyLoad = (conponent: ReactNode): ReactNode => {
Expand Down Expand Up @@ -103,6 +99,11 @@ const AppRouter = () => {
{
path: '/process',
element: lazyLoad(<Process />)
},
// file
{
path: '/file',
element: lazyLoad(<File />)
}
]
},
Expand Down
7 changes: 7 additions & 0 deletions src/views/file/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { observer } from 'mobx-react';

function File() {
return <>word | excel | pdf 在线预览,开发中...</>;
}

export default observer(File);

0 comments on commit 209ca56

Please sign in to comment.