diff --git a/packages/fes-preset-built-in/src/plugins/route/index.js b/packages/fes-preset-built-in/src/plugins/route/index.js index 86d7b0fc..11700a53 100644 --- a/packages/fes-preset-built-in/src/plugins/route/index.js +++ b/packages/fes-preset-built-in/src/plugins/route/index.js @@ -71,7 +71,9 @@ function getRouteMeta(content) { )[0]; if (defineRouteExpression) { const argument = generator(defineRouteExpression.expression.arguments[0]); - return JSON.parse(argument.code.replace(/'/g, '"').replace(/(\S+):/g, (global, m1) => `"${m1}":`)); + // eslint-disable-next-line no-eval + const fn = eval(`() => (${argument.code})`); + return fn(); } } catch (err) {} return null; diff --git a/packages/fes-template-vite/src/pages/index.vue b/packages/fes-template-vite/src/pages/index.vue index 30e02cd0..2e1a6646 100644 --- a/packages/fes-template-vite/src/pages/index.vue +++ b/packages/fes-template-vite/src/pages/index.vue @@ -6,10 +6,14 @@ -