File tree Expand file tree Collapse file tree 6 files changed +339
-3885
lines changed Expand file tree Collapse file tree 6 files changed +339
-3885
lines changed Original file line number Diff line number Diff line change @@ -6,12 +6,12 @@ export default defineConfig({
6
6
dynamicImport : {
7
7
loading : '@/components/LoadingPage/index' ,
8
8
} ,
9
+ outputPath : 'build' ,
10
+ antd : { } ,
11
+ esbuild : { } ,
9
12
dynamicImportSyntax : { } ,
10
13
hash : true ,
11
- outputPath : 'build' ,
12
14
routes : routeConfig ,
13
- esbuild : { } ,
14
- layout : false ,
15
15
metas : [
16
16
{ name : 'msapplication-TileColor' , content : '#da532c' } ,
17
17
{ name : 'theme-color' , content : '#ffffff' } ,
Original file line number Diff line number Diff line change @@ -3,12 +3,12 @@ import AntdDayjsWebpackPlugin from 'antd-dayjs-webpack-plugin';
3
3
import routeConfig from './routeConfig' ;
4
4
5
5
export default defineConfig ( {
6
+ antd : { } ,
7
+ esbuild : { } ,
6
8
dynamicImportSyntax : { } ,
7
9
hash : true ,
8
10
outputPath : 'build' ,
9
11
routes : routeConfig ,
10
- esbuild : { } ,
11
- layout : false ,
12
12
metas : [
13
13
{ name : 'msapplication-TileColor' , content : '#da532c' } ,
14
14
{ name : 'theme-color' , content : '#ffffff' } ,
Original file line number Diff line number Diff line change 47
47
"dependencies" : {
48
48
"@ant-design/pro-form" : " ^1.18.1" ,
49
49
"@ant-design/pro-layout" : " ^6.5.0" ,
50
- "@umijs/preset-react" : " 1.x" ,
50
+ "@umijs/plugin-access" : " ^2.3.3" ,
51
+ "@umijs/plugin-antd" : " ^0.9.1" ,
52
+ "@umijs/plugin-initial-state" : " ^2.3.0" ,
53
+ "@umijs/plugin-model" : " ^2.5.6" ,
51
54
"classnames" : " ^2.2.6" ,
55
+ "dayjs" : " ^1.10.4" ,
52
56
"react" : " ^17.0.1" ,
53
57
"react-dom" : " ^17.0.1" ,
54
- "umi" : " ^3.4.2"
58
+ "umi" : " ^3.4.2" ,
59
+ "umi-request" : " ^1.3.5"
55
60
},
56
61
"devDependencies" : {
57
62
"@commitlint/cli" : " ^12.0.1" ,
Original file line number Diff line number Diff line change
1
+ import { useCallback , useRef } from 'react' ;
2
+
3
+ /**
4
+ * 将函数挂到 ref 上,保证永远都是拿到最新状态的函数,往外暴露时使用 useCallback 包裹,保证函数引用不更新
5
+ * @param callback
6
+ * @returns
7
+ */
8
+ export default function useRefCallback < T extends ( ...args : any [ ] ) => any > ( callback : T ) {
9
+ const callbackRef = useRef ( callback ) ;
10
+ callbackRef . current = callback ;
11
+
12
+ return useCallback ( ( ...args : any [ ] ) => callbackRef . current ( ...args ) , [ ] ) as T ;
13
+ }
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import { useCallback } from 'react';
3
3
4
4
export default function useToast ( ) {
5
5
const toastSuccess = useCallback ( ( msg : string ) => message . success ( msg ) , [ ] ) ;
6
-
7
6
const toastFailure = useCallback ( ( msg : string ) => message . error ( msg ) , [ ] ) ;
8
7
9
8
return {
You can’t perform that action at this time.
0 commit comments