@baic/yolk-cli 2.1.0-alpha.103 → 2.1.0-alpha.105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/templates/umi-mobile/.umirc.ts.tpl +0 -1
- package/templates/umi-mobile/src/.umi/core/EmptyRoute.tsx +8 -0
- package/templates/umi-mobile/src/.umi/core/defineApp.ts +21 -0
- package/templates/umi-mobile/src/.umi/core/history.ts +70 -0
- package/templates/umi-mobile/src/.umi/core/historyIntelli.ts +132 -0
- package/templates/umi-mobile/src/.umi/core/plugin.ts +83 -0
- package/templates/umi-mobile/src/.umi/core/pluginConfig.d.ts +295 -0
- package/templates/umi-mobile/src/.umi/core/polyfill.ts +191 -0
- package/templates/umi-mobile/src/.umi/core/route.tsx +267 -0
- package/templates/umi-mobile/src/.umi/core/routeProps.js +3 -0
- package/templates/umi-mobile/src/.umi/core/routeProps.ts +4 -0
- package/templates/umi-mobile/src/.umi/core/terminal.ts +62 -0
- package/templates/umi-mobile/src/.umi/exports.ts +51 -0
- package/templates/umi-mobile/src/.umi/plugin-clickToComponent/runtime.tsx +19 -0
- package/templates/umi-mobile/src/.umi/plugin-errorBoundary/runtime.tsx +67 -0
- package/templates/umi-mobile/src/.umi/plugin-hd/runtime.tsx +57 -0
- package/templates/umi-mobile/src/.umi/testBrowser.tsx +91 -0
- package/templates/umi-mobile/src/.umi/tsconfig.json +29 -0
- package/templates/umi-mobile/src/.umi/typings.d.ts +138 -0
- package/templates/umi-mobile/src/.umi/umi.ts +76 -0
- package/templates/umi-mobile/src/app.tsx +2 -2
- package/templates/umi-mobile/src/pages/404.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/BarCode.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/Iconfont.tsx +1 -2
- package/templates/umi-mobile/src/pages/demo/examples/Input.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/List/1.tsx +1 -2
- package/templates/umi-mobile/src/pages/demo/examples/List/2.tsx +1 -1
- package/templates/umi-mobile/src/pages/demo/examples/List/3.tsx +1 -1
- package/templates/umi-mobile/src/pages/demo/examples/List/4.tsx +7 -8
- package/templates/umi-mobile/src/pages/demo/examples/Loading.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/NumberInput/1.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/NumberInput/2.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/NumberInput/3.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/NumberInput/4.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/PagingList/1.tsx +1 -2
- package/templates/umi-mobile/src/pages/demo/examples/QrCode.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/Required.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/TimerButton.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/usePreload.tsx +1 -1
- package/templates/umi-mobile/src/pages/demo/index.tsx +8 -8
- package/templates/umi-mobile/src/pages/index.tsx +0 -2
- package/templates/umi-mobile-h5+app/.umirc.ts.tpl +0 -1
- package/templates/umi-mobile-native/.umirc.ts.tpl +0 -1
- package/templates/umi-web/.umirc.ts.tpl +0 -1
- package/templates/umi-web/src/pages/404.tsx +2 -3
- package/templates/umi-web/src/pages/demo/index.tsx +3 -2
- package/templates/umi-web/src/pages/index.tsx +0 -2
- package/templates/umi-web-screen/.umirc.ts.tpl +0 -1
- package/templates/umi-web-screen/src/components/resize-container/index.tsx +9 -8
- package/templates/umi-web-screen/src/pages/404.tsx +2 -3
- package/templates/umi-web-screen/src/pages/template/components/charts/demo-line/index.tsx +1 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// This file is generated by Umi automatically
|
|
3
|
+
// DO NOT CHANGE IT MANUALLY!
|
|
4
|
+
import { ClickToComponent } from 'click-to-react-component';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
export function rootContainer(container, opts) {
|
|
7
|
+
return React.createElement(
|
|
8
|
+
(props) => {
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
<ClickToComponent editor="vscode" />
|
|
12
|
+
{props.children}
|
|
13
|
+
</>
|
|
14
|
+
);
|
|
15
|
+
},
|
|
16
|
+
opts,
|
|
17
|
+
container,
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// This file is generated by Umi automatically
|
|
3
|
+
// DO NOT CHANGE IT MANUALLY!
|
|
4
|
+
import type { CSSProperties, PropsWithChildren, ReactNode } from 'react';
|
|
5
|
+
import { Component } from 'react';
|
|
6
|
+
|
|
7
|
+
class CatchError extends Component<PropsWithChildren> {
|
|
8
|
+
state = { error: null };
|
|
9
|
+
static getDerivedStateFromError(error: any) {
|
|
10
|
+
return { error };
|
|
11
|
+
}
|
|
12
|
+
render() {
|
|
13
|
+
const { children } = this.props;
|
|
14
|
+
const { error } = this.state;
|
|
15
|
+
if (error) {
|
|
16
|
+
document.title = '系统错误,请联系管理员';
|
|
17
|
+
const pageStyle: CSSProperties = {
|
|
18
|
+
position: 'fixed',
|
|
19
|
+
left: 0,
|
|
20
|
+
right: 0,
|
|
21
|
+
top: 0,
|
|
22
|
+
bottom: 0,
|
|
23
|
+
display: 'flex',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
justifyContent: 'center',
|
|
26
|
+
};
|
|
27
|
+
const messageStyle: CSSProperties = {
|
|
28
|
+
position: 'absolute',
|
|
29
|
+
left: 0,
|
|
30
|
+
right: 0,
|
|
31
|
+
top: 0,
|
|
32
|
+
color: '#fff',
|
|
33
|
+
backgroundColor: '#ff4d4f',
|
|
34
|
+
fontSize: '16px',
|
|
35
|
+
lineHeight: 1.5,
|
|
36
|
+
padding: '10px',
|
|
37
|
+
textAlign: 'center',
|
|
38
|
+
};
|
|
39
|
+
const buttonStyle: CSSProperties = {
|
|
40
|
+
padding: '8px 20px',
|
|
41
|
+
fontSize: '14px',
|
|
42
|
+
lineHeight: 1.5,
|
|
43
|
+
borderRadius: '5px',
|
|
44
|
+
backgroundColor: '#1677ff',
|
|
45
|
+
color: '#fff',
|
|
46
|
+
};
|
|
47
|
+
return (
|
|
48
|
+
<div style={pageStyle}>
|
|
49
|
+
<div style={messageStyle}>系统错误,请联系管理员</div>
|
|
50
|
+
<div
|
|
51
|
+
style={buttonStyle}
|
|
52
|
+
onClick={() =>
|
|
53
|
+
window.location.replace(`${location.origin}${location.pathname}`)
|
|
54
|
+
}
|
|
55
|
+
>
|
|
56
|
+
返回首页
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
return <>{children}</>;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function rootContainer(container: ReactNode) {
|
|
66
|
+
return <CatchError>{container}</CatchError>;
|
|
67
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// This file is generated by Umi automatically
|
|
3
|
+
// DO NOT CHANGE IT MANUALLY!
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
import vl from 'umi-hd';
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
import flex from 'umi-hd/lib/flex';
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
import vw from 'umi-hd/lib/vw';
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
import vh from 'umi-hd/lib/vh';
|
|
14
|
+
|
|
15
|
+
const HD_MODES = {
|
|
16
|
+
vl,
|
|
17
|
+
flex,
|
|
18
|
+
vw,
|
|
19
|
+
vh,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const HD = ({ children }: { children?: React.ReactNode }) => {
|
|
23
|
+
const handler = React.useCallback(() => {
|
|
24
|
+
const { clientWidth } = document.documentElement;
|
|
25
|
+
|
|
26
|
+
[{ mode: 'vl', options: [14, 375] }]
|
|
27
|
+
// discard invalid rules
|
|
28
|
+
.filter((rule) => HD_MODES[rule.mode])
|
|
29
|
+
// match first valid rule
|
|
30
|
+
.some((rule) => {
|
|
31
|
+
if (
|
|
32
|
+
// without min & max width
|
|
33
|
+
(Number.isNaN(rule.minWidth * 1) &&
|
|
34
|
+
Number.isNaN(rule.maxWidth * 1)) ||
|
|
35
|
+
// min width only
|
|
36
|
+
(Number.isNaN(rule.maxWidth * 1) && clientWidth > rule.minWidth) ||
|
|
37
|
+
// max width only
|
|
38
|
+
(Number.isNaN(rule.minWidth * 1) && clientWidth < rule.maxWidth) ||
|
|
39
|
+
// both min & max width
|
|
40
|
+
(clientWidth > rule.minWidth && clientWidth < rule.maxWidth)
|
|
41
|
+
) {
|
|
42
|
+
HD_MODES[rule.mode](...[].concat(rule.options));
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}, []);
|
|
47
|
+
React.useEffect(() => {
|
|
48
|
+
handler();
|
|
49
|
+
window.addEventListener('resize', handler);
|
|
50
|
+
return () => window.removeEventListener('resize', handler);
|
|
51
|
+
}, []);
|
|
52
|
+
return <>{children}</>;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export function rootContainer(container: React.ReactNode) {
|
|
56
|
+
return <HD>{container}</HD>;
|
|
57
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// This file is generated by Umi automatically
|
|
3
|
+
// DO NOT CHANGE IT MANUALLY!
|
|
4
|
+
import type { Location } from 'history';
|
|
5
|
+
import React, { useEffect, useState } from 'react';
|
|
6
|
+
import { ApplyPluginsType } from 'umi';
|
|
7
|
+
import { createHistory } from './core/history';
|
|
8
|
+
import { createPluginManager } from './core/plugin';
|
|
9
|
+
import { getRoutes } from './core/route';
|
|
10
|
+
import {
|
|
11
|
+
renderClient,
|
|
12
|
+
RenderClientOpts,
|
|
13
|
+
} from '/Users/baicheng/Desktop/git.zdhrsoft.com/agricultural-cow-trading-mobile/node_modules/.pnpm/@umijs+renderer-react@4.0.53_ef5jwxihqo6n7gxfmzogljlgcm/node_modules/@umijs/renderer-react';
|
|
14
|
+
|
|
15
|
+
import 'antd/dist/antd.less';
|
|
16
|
+
import '/Users/baicheng/Desktop/git.zdhrsoft.com/agricultural-cow-trading-mobile/src/global.less';
|
|
17
|
+
const publicPath = '/';
|
|
18
|
+
const runtimePublicPath = false;
|
|
19
|
+
|
|
20
|
+
type TestBrowserProps = {
|
|
21
|
+
location?: Partial<Location>;
|
|
22
|
+
historyRef?: React.MutableRefObject<Location>;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export function TestBrowser(props: TestBrowserProps) {
|
|
26
|
+
const pluginManager = createPluginManager();
|
|
27
|
+
const [context, setContext] = useState<RenderClientOpts | undefined>(
|
|
28
|
+
undefined,
|
|
29
|
+
);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const genContext = async () => {
|
|
32
|
+
const { routes, routeComponents } = await getRoutes(pluginManager);
|
|
33
|
+
// allow user to extend routes
|
|
34
|
+
await pluginManager.applyPlugins({
|
|
35
|
+
key: 'patchRoutes',
|
|
36
|
+
type: ApplyPluginsType.event,
|
|
37
|
+
args: {
|
|
38
|
+
routes,
|
|
39
|
+
routeComponents,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
const contextOpts = pluginManager.applyPlugins({
|
|
43
|
+
key: 'modifyContextOpts',
|
|
44
|
+
type: ApplyPluginsType.modify,
|
|
45
|
+
initialValue: {},
|
|
46
|
+
});
|
|
47
|
+
const basename = contextOpts.basename || '/';
|
|
48
|
+
const history = createHistory({
|
|
49
|
+
type: 'memory',
|
|
50
|
+
basename,
|
|
51
|
+
});
|
|
52
|
+
const context = {
|
|
53
|
+
routes,
|
|
54
|
+
routeComponents,
|
|
55
|
+
pluginManager,
|
|
56
|
+
rootElement: contextOpts.rootElement || document.getElementById('root'),
|
|
57
|
+
publicPath,
|
|
58
|
+
runtimePublicPath,
|
|
59
|
+
history,
|
|
60
|
+
basename,
|
|
61
|
+
components: true,
|
|
62
|
+
};
|
|
63
|
+
const modifiedContext = pluginManager.applyPlugins({
|
|
64
|
+
key: 'modifyClientRenderOpts',
|
|
65
|
+
type: ApplyPluginsType.modify,
|
|
66
|
+
initialValue: context,
|
|
67
|
+
});
|
|
68
|
+
return modifiedContext;
|
|
69
|
+
};
|
|
70
|
+
genContext().then((context) => {
|
|
71
|
+
setContext(context);
|
|
72
|
+
if (props.location) {
|
|
73
|
+
context?.history?.push(props.location);
|
|
74
|
+
}
|
|
75
|
+
if (props.historyRef) {
|
|
76
|
+
props.historyRef.current = context?.history;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}, []);
|
|
80
|
+
|
|
81
|
+
if (context === undefined) {
|
|
82
|
+
return <div id="loading" />;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const Children = renderClient(context);
|
|
86
|
+
return (
|
|
87
|
+
<React.Fragment>
|
|
88
|
+
<Children />
|
|
89
|
+
</React.Fragment>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "esnext",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"importHelpers": true,
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"sourceMap": true,
|
|
10
|
+
"baseUrl": "../../",
|
|
11
|
+
"strict": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"allowSyntheticDefaultImports": true,
|
|
14
|
+
"paths": {
|
|
15
|
+
"@/*": ["src/*"],
|
|
16
|
+
"@@/*": ["src/.umi/*"],
|
|
17
|
+
"@umijs/max": [
|
|
18
|
+
"/Users/baicheng/Desktop/git.zdhrsoft.com/agricultural-cow-trading-mobile/node_modules/.pnpm/umi@4.0.53_cgysqeyhmhrzwx2zpdtuppefcq/node_modules/umi"
|
|
19
|
+
],
|
|
20
|
+
"@umijs/max/typings": ["src/.umi/typings"]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"include": [
|
|
24
|
+
"../../.umirc.ts",
|
|
25
|
+
"../../**/*.d.ts",
|
|
26
|
+
"../../**/*.ts",
|
|
27
|
+
"../../**/*.tsx"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// This file is generated by Umi automatically
|
|
2
|
+
// DO NOT CHANGE IT MANUALLY!
|
|
3
|
+
type CSSModuleClasses = { readonly [key: string]: string };
|
|
4
|
+
declare module '*.css' {
|
|
5
|
+
const classes: CSSModuleClasses;
|
|
6
|
+
export default classes;
|
|
7
|
+
}
|
|
8
|
+
declare module '*.scss' {
|
|
9
|
+
const classes: CSSModuleClasses;
|
|
10
|
+
export default classes;
|
|
11
|
+
}
|
|
12
|
+
declare module '*.sass' {
|
|
13
|
+
const classes: CSSModuleClasses;
|
|
14
|
+
export default classes;
|
|
15
|
+
}
|
|
16
|
+
declare module '*.less' {
|
|
17
|
+
const classes: CSSModuleClasses;
|
|
18
|
+
export default classes;
|
|
19
|
+
}
|
|
20
|
+
declare module '*.styl' {
|
|
21
|
+
const classes: CSSModuleClasses;
|
|
22
|
+
export default classes;
|
|
23
|
+
}
|
|
24
|
+
declare module '*.stylus' {
|
|
25
|
+
const classes: CSSModuleClasses;
|
|
26
|
+
export default classes;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// images
|
|
30
|
+
declare module '*.jpg' {
|
|
31
|
+
const src: string;
|
|
32
|
+
export default src;
|
|
33
|
+
}
|
|
34
|
+
declare module '*.jpeg' {
|
|
35
|
+
const src: string;
|
|
36
|
+
export default src;
|
|
37
|
+
}
|
|
38
|
+
declare module '*.png' {
|
|
39
|
+
const src: string;
|
|
40
|
+
export default src;
|
|
41
|
+
}
|
|
42
|
+
declare module '*.gif' {
|
|
43
|
+
const src: string;
|
|
44
|
+
export default src;
|
|
45
|
+
}
|
|
46
|
+
declare module '*.svg' {
|
|
47
|
+
import * as React from 'react';
|
|
48
|
+
export const ReactComponent: React.FunctionComponent<
|
|
49
|
+
React.SVGProps<SVGSVGElement> & { title?: string }
|
|
50
|
+
>;
|
|
51
|
+
|
|
52
|
+
const src: string;
|
|
53
|
+
export default src;
|
|
54
|
+
}
|
|
55
|
+
declare module '*.ico' {
|
|
56
|
+
const src: string;
|
|
57
|
+
export default src;
|
|
58
|
+
}
|
|
59
|
+
declare module '*.webp' {
|
|
60
|
+
const src: string;
|
|
61
|
+
export default src;
|
|
62
|
+
}
|
|
63
|
+
declare module '*.avif' {
|
|
64
|
+
const src: string;
|
|
65
|
+
export default src;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// media
|
|
69
|
+
declare module '*.mp4' {
|
|
70
|
+
const src: string;
|
|
71
|
+
export default src;
|
|
72
|
+
}
|
|
73
|
+
declare module '*.webm' {
|
|
74
|
+
const src: string;
|
|
75
|
+
export default src;
|
|
76
|
+
}
|
|
77
|
+
declare module '*.ogg' {
|
|
78
|
+
const src: string;
|
|
79
|
+
export default src;
|
|
80
|
+
}
|
|
81
|
+
declare module '*.mp3' {
|
|
82
|
+
const src: string;
|
|
83
|
+
export default src;
|
|
84
|
+
}
|
|
85
|
+
declare module '*.wav' {
|
|
86
|
+
const src: string;
|
|
87
|
+
export default src;
|
|
88
|
+
}
|
|
89
|
+
declare module '*.flac' {
|
|
90
|
+
const src: string;
|
|
91
|
+
export default src;
|
|
92
|
+
}
|
|
93
|
+
declare module '*.aac' {
|
|
94
|
+
const src: string;
|
|
95
|
+
export default src;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// fonts
|
|
99
|
+
declare module '*.woff' {
|
|
100
|
+
const src: string;
|
|
101
|
+
export default src;
|
|
102
|
+
}
|
|
103
|
+
declare module '*.woff2' {
|
|
104
|
+
const src: string;
|
|
105
|
+
export default src;
|
|
106
|
+
}
|
|
107
|
+
declare module '*.eot' {
|
|
108
|
+
const src: string;
|
|
109
|
+
export default src;
|
|
110
|
+
}
|
|
111
|
+
declare module '*.ttf' {
|
|
112
|
+
const src: string;
|
|
113
|
+
export default src;
|
|
114
|
+
}
|
|
115
|
+
declare module '*.otf' {
|
|
116
|
+
const src: string;
|
|
117
|
+
export default src;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// other
|
|
121
|
+
declare module '*.wasm' {
|
|
122
|
+
const initWasm: (
|
|
123
|
+
options: WebAssembly.Imports,
|
|
124
|
+
) => Promise<WebAssembly.Exports>;
|
|
125
|
+
export default initWasm;
|
|
126
|
+
}
|
|
127
|
+
declare module '*.webmanifest' {
|
|
128
|
+
const src: string;
|
|
129
|
+
export default src;
|
|
130
|
+
}
|
|
131
|
+
declare module '*.pdf' {
|
|
132
|
+
const src: string;
|
|
133
|
+
export default src;
|
|
134
|
+
}
|
|
135
|
+
declare module '*.txt' {
|
|
136
|
+
const src: string;
|
|
137
|
+
export default src;
|
|
138
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// This file is generated by Umi automatically
|
|
3
|
+
// DO NOT CHANGE IT MANUALLY!
|
|
4
|
+
import 'antd/dist/antd.less';
|
|
5
|
+
import { ApplyPluginsType } from 'umi';
|
|
6
|
+
import { createHistory } from './core/history';
|
|
7
|
+
import { createPluginManager } from './core/plugin';
|
|
8
|
+
import './core/polyfill';
|
|
9
|
+
import { getRoutes } from './core/route';
|
|
10
|
+
import { renderClient } from '/Users/baicheng/Desktop/git.zdhrsoft.com/agricultural-cow-trading-mobile/node_modules/.pnpm/@umijs+renderer-react@4.0.53_ef5jwxihqo6n7gxfmzogljlgcm/node_modules/@umijs/renderer-react';
|
|
11
|
+
import '/Users/baicheng/Desktop/git.zdhrsoft.com/agricultural-cow-trading-mobile/src/global.less';
|
|
12
|
+
|
|
13
|
+
const publicPath = '/';
|
|
14
|
+
const runtimePublicPath = false;
|
|
15
|
+
|
|
16
|
+
async function render() {
|
|
17
|
+
const pluginManager = createPluginManager();
|
|
18
|
+
const { routes, routeComponents } = await getRoutes(pluginManager);
|
|
19
|
+
|
|
20
|
+
// allow user to extend routes
|
|
21
|
+
await pluginManager.applyPlugins({
|
|
22
|
+
key: 'patchRoutes',
|
|
23
|
+
type: ApplyPluginsType.event,
|
|
24
|
+
args: {
|
|
25
|
+
routes,
|
|
26
|
+
routeComponents,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const contextOpts = pluginManager.applyPlugins({
|
|
31
|
+
key: 'modifyContextOpts',
|
|
32
|
+
type: ApplyPluginsType.modify,
|
|
33
|
+
initialValue: {},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const basename = contextOpts.basename || '/';
|
|
37
|
+
const historyType = contextOpts.historyType || 'hash';
|
|
38
|
+
|
|
39
|
+
const history = createHistory({
|
|
40
|
+
type: historyType,
|
|
41
|
+
basename,
|
|
42
|
+
...contextOpts.historyOpts,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return pluginManager.applyPlugins({
|
|
46
|
+
key: 'render',
|
|
47
|
+
type: ApplyPluginsType.compose,
|
|
48
|
+
initialValue() {
|
|
49
|
+
const context = {
|
|
50
|
+
routes,
|
|
51
|
+
routeComponents,
|
|
52
|
+
pluginManager,
|
|
53
|
+
rootElement:
|
|
54
|
+
contextOpts.rootElement || document.getElementById('yolk-app'),
|
|
55
|
+
publicPath,
|
|
56
|
+
runtimePublicPath,
|
|
57
|
+
history,
|
|
58
|
+
historyType,
|
|
59
|
+
basename,
|
|
60
|
+
callback: contextOpts.callback,
|
|
61
|
+
};
|
|
62
|
+
const modifiedContext = pluginManager.applyPlugins({
|
|
63
|
+
key: 'modifyClientRenderOpts',
|
|
64
|
+
type: ApplyPluginsType.modify,
|
|
65
|
+
initialValue: context,
|
|
66
|
+
});
|
|
67
|
+
return renderClient(modifiedContext);
|
|
68
|
+
},
|
|
69
|
+
})();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
render();
|
|
73
|
+
|
|
74
|
+
window.g_umi = {
|
|
75
|
+
version: '4.0.53',
|
|
76
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import '@baic/yolk-mobile/es/style/index.less';
|
|
2
|
+
|
|
1
3
|
import { Provider } from '@baic/yolk-mobile';
|
|
2
4
|
|
|
3
5
|
import request from '@/common/request';
|
|
4
6
|
|
|
5
|
-
import '@baic/yolk-mobile/es/style/index.less';
|
|
6
|
-
|
|
7
7
|
export function rootContainer(container: React.ReactNode) {
|
|
8
8
|
return (
|
|
9
9
|
<Provider
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
|
+
|
|
2
3
|
import { Image } from 'antd-mobile';
|
|
4
|
+
|
|
3
5
|
import { List, ListVirtualizedScrollEvent } from '@baic/yolk-mobile';
|
|
4
6
|
|
|
5
7
|
const rowCount = 100000;
|
|
@@ -14,13 +16,10 @@ const item = {
|
|
|
14
16
|
const mock = Array(rowCount).fill(item);
|
|
15
17
|
|
|
16
18
|
export default () => {
|
|
17
|
-
const onScrollHandler =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
[],
|
|
22
|
-
);
|
|
23
|
-
const virtualizedMemo = React.useMemo(
|
|
19
|
+
const onScrollHandler = useCallback(async (e: ListVirtualizedScrollEvent) => {
|
|
20
|
+
console.log(e);
|
|
21
|
+
}, []);
|
|
22
|
+
const virtualizedMemo = useMemo(
|
|
24
23
|
() => ({
|
|
25
24
|
height: 500,
|
|
26
25
|
rowHeight: 60,
|