jjb-cmd 1.0.16 → 1.0.17
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
CHANGED
@@ -26,15 +26,11 @@ export const registerApplication = (selector = '#root') => {
|
|
26
26
|
return {
|
27
27
|
mount: () => render(),
|
28
28
|
unmount: props => {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
unmountComponentAtNode(element);
|
35
|
-
} else {
|
36
|
-
console.error('卸载APP失败,原因:', '当前环境非QianKun');
|
37
|
-
}
|
29
|
+
const { container } = props;
|
30
|
+
const element = container
|
31
|
+
? container.querySelector(selector)
|
32
|
+
: document.querySelector(selector);
|
33
|
+
unmountComponentAtNode(element);
|
38
34
|
},
|
39
35
|
bootstrap: props => props
|
40
36
|
};
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
import React from 'react';
|
8
8
|
import { ConfigProvider } from 'antd';
|
9
|
-
import {
|
9
|
+
import { BrowserRouter, Route, Switch } from 'dva/router';
|
10
10
|
|
11
11
|
/**
|
12
12
|
* @description 是否匹配页面
|
@@ -153,27 +153,26 @@ function treeRoutes (routes = []) {
|
|
153
153
|
return optimizationTree(result);
|
154
154
|
}
|
155
155
|
|
156
|
-
function
|
156
|
+
function RenderRoute (routes = [], inProps = {}) {
|
157
157
|
return (
|
158
|
-
<
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
</Router>
|
158
|
+
<Switch>
|
159
|
+
{routes.map(({
|
160
|
+
path,
|
161
|
+
children,
|
162
|
+
Component
|
163
|
+
}, index) => (
|
164
|
+
<Route
|
165
|
+
exact={path === '/'}
|
166
|
+
key={index}
|
167
|
+
path={path}
|
168
|
+
render={props => (
|
169
|
+
<Component {...props}>
|
170
|
+
{RenderRoute(children, inProps)}
|
171
|
+
</Component>
|
172
|
+
)}
|
173
|
+
/>
|
174
|
+
))}
|
175
|
+
</Switch>
|
177
176
|
);
|
178
177
|
}
|
179
178
|
|
@@ -189,10 +188,23 @@ export const AutomaticRouter = ({
|
|
189
188
|
}) => {
|
190
189
|
return (
|
191
190
|
<ConfigProvider locale={require('antd/lib/locale/zh_CN').default}>
|
192
|
-
{
|
193
|
-
|
194
|
-
|
195
|
-
|
191
|
+
<BrowserRouter basename={(process.env.app || {}).basename || ''}>
|
192
|
+
<Switch>
|
193
|
+
{(process.env.app || {}).notRouter
|
194
|
+
? (
|
195
|
+
<Route
|
196
|
+
path="*"
|
197
|
+
component={require('~/pages').default}
|
198
|
+
/>
|
199
|
+
)
|
200
|
+
: (
|
201
|
+
RenderRoute(treeRoutes(getRoutes()), {
|
202
|
+
app,
|
203
|
+
history
|
204
|
+
})
|
205
|
+
)}
|
206
|
+
</Switch>
|
207
|
+
</BrowserRouter>
|
196
208
|
</ConfigProvider>
|
197
209
|
);
|
198
210
|
};
|