mirror of
https://gitee.com/WeBank/fes.js.git
synced 2024-11-30 10:48:12 +08:00
Merge pull request #61 from WeBankFinTech/patchRoutes
fix: patchRoutes 重复调用问题
This commit is contained in:
commit
be7c534e24
@ -31,7 +31,7 @@ const renderClient = (opts = {}) => {
|
|||||||
plugin.applyPlugins({
|
plugin.applyPlugins({
|
||||||
key: 'onAppCreated',
|
key: 'onAppCreated',
|
||||||
type: ApplyPluginsType.event,
|
type: ApplyPluginsType.event,
|
||||||
args: { app },
|
args: { app, routes },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (rootElement) {
|
if (rootElement) {
|
||||||
|
@ -16,7 +16,7 @@ export function getRoutes() {
|
|||||||
const ROUTER_BASE = '{{{ routerBase }}}';
|
const ROUTER_BASE = '{{{ routerBase }}}';
|
||||||
let router = null;
|
let router = null;
|
||||||
let history = null;
|
let history = null;
|
||||||
export const createRouter = () => {
|
export const createRouter = (routes) => {
|
||||||
if (router) {
|
if (router) {
|
||||||
return router;
|
return router;
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ export const createRouter = () => {
|
|||||||
});
|
});
|
||||||
router = createVueRouter({
|
router = createVueRouter({
|
||||||
history,
|
history,
|
||||||
routes: getRoutes()
|
routes
|
||||||
});
|
});
|
||||||
|
|
||||||
plugin.applyPlugins({
|
plugin.applyPlugins({
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { createRouter } from "./routes";
|
import { createRouter } from "./routes";
|
||||||
|
|
||||||
export function onAppCreated({ app }) {
|
export function onAppCreated({ app, routes }) {
|
||||||
const router = createRouter();
|
const router = createRouter(routes);
|
||||||
app.use(router);
|
app.use(router);
|
||||||
}
|
}
|
||||||
|
@ -12,3 +12,7 @@ export const request = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function patchRoutes() {
|
||||||
|
console.log('patchRoutes');
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user