Merge pull request #61 from WeBankFinTech/patchRoutes

fix: patchRoutes 重复调用问题
This commit is contained in:
harrywan 2021-05-26 10:12:36 +08:00 committed by GitHub
commit be7c534e24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 5 deletions

View File

@ -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) {

View File

@ -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({

View File

@ -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);
} }

View File

@ -12,3 +12,7 @@ export const request = {
} }
} }
}; };
export function patchRoutes() {
console.log('patchRoutes');
}