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({
|
||||
key: 'onAppCreated',
|
||||
type: ApplyPluginsType.event,
|
||||
args: { app },
|
||||
args: { app, routes },
|
||||
});
|
||||
|
||||
if (rootElement) {
|
||||
|
@ -16,7 +16,7 @@ export function getRoutes() {
|
||||
const ROUTER_BASE = '{{{ routerBase }}}';
|
||||
let router = null;
|
||||
let history = null;
|
||||
export const createRouter = () => {
|
||||
export const createRouter = (routes) => {
|
||||
if (router) {
|
||||
return router;
|
||||
}
|
||||
@ -27,7 +27,7 @@ export const createRouter = () => {
|
||||
});
|
||||
router = createVueRouter({
|
||||
history,
|
||||
routes: getRoutes()
|
||||
routes
|
||||
});
|
||||
|
||||
plugin.applyPlugins({
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { createRouter } from "./routes";
|
||||
|
||||
export function onAppCreated({ app }) {
|
||||
const router = createRouter();
|
||||
export function onAppCreated({ app, routes }) {
|
||||
const router = createRouter(routes);
|
||||
app.use(router);
|
||||
}
|
||||
|
@ -12,3 +12,7 @@ export const request = {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export function patchRoutes() {
|
||||
console.log('patchRoutes');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user