diff --git a/packages/fes-preset-built-in/src/plugins/generateFiles/fes/fes.tpl b/packages/fes-preset-built-in/src/plugins/generateFiles/fes/fes.tpl index a4d45f41..a2ecd1d9 100644 --- a/packages/fes-preset-built-in/src/plugins/generateFiles/fes/fes.tpl +++ b/packages/fes-preset-built-in/src/plugins/generateFiles/fes/fes.tpl @@ -31,7 +31,7 @@ const renderClient = (opts = {}) => { plugin.applyPlugins({ key: 'onAppCreated', type: ApplyPluginsType.event, - args: { app }, + args: { app, routes }, }); if (rootElement) { diff --git a/packages/fes-preset-built-in/src/plugins/misc/route/template/routes.tpl b/packages/fes-preset-built-in/src/plugins/misc/route/template/routes.tpl index 3e134cd6..55fddff5 100644 --- a/packages/fes-preset-built-in/src/plugins/misc/route/template/routes.tpl +++ b/packages/fes-preset-built-in/src/plugins/misc/route/template/routes.tpl @@ -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({ diff --git a/packages/fes-preset-built-in/src/plugins/misc/route/template/runtime.tpl b/packages/fes-preset-built-in/src/plugins/misc/route/template/runtime.tpl index 3c40ee5d..7d05be90 100644 --- a/packages/fes-preset-built-in/src/plugins/misc/route/template/runtime.tpl +++ b/packages/fes-preset-built-in/src/plugins/misc/route/template/runtime.tpl @@ -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); } diff --git a/packages/fes-template-h5/src/app.js b/packages/fes-template-h5/src/app.js index 9da182a1..8d70d71f 100644 --- a/packages/fes-template-h5/src/app.js +++ b/packages/fes-template-h5/src/app.js @@ -12,3 +12,7 @@ export const request = { } } }; + +export function patchRoutes() { + console.log('patchRoutes'); +}