mvframe 1.0.15 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/scripts/scaffold-app.js +135 -54
package/dist/index.js
CHANGED
|
@@ -2983,7 +2983,7 @@ const Tt = Ie({
|
|
|
2983
2983
|
}, sl = {
|
|
2984
2984
|
name: "Matt Avias Frame",
|
|
2985
2985
|
copyright: "©2026",
|
|
2986
|
-
version: "1.0.
|
|
2986
|
+
version: "1.0.16",
|
|
2987
2987
|
author: "Matt Avias",
|
|
2988
2988
|
date: "2026-02-26",
|
|
2989
2989
|
/** 默认语言 key,与 `$getLang`、localStorage `lang` 一致;业务在 app.use(mvframe, { config }) 里覆盖 */
|
package/package.json
CHANGED
package/scripts/scaffold-app.js
CHANGED
|
@@ -106,8 +106,10 @@ function main() {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
const dirs = [
|
|
109
|
-
"src/views/
|
|
110
|
-
"src/views/
|
|
109
|
+
"src/views/Launch",
|
|
110
|
+
"src/views/Overview",
|
|
111
|
+
"src/views/A",
|
|
112
|
+
"src/views/B",
|
|
111
113
|
"src/component",
|
|
112
114
|
"src/assets/img",
|
|
113
115
|
"src/assets/style",
|
|
@@ -129,7 +131,7 @@ import "element-plus/dist/index.css";
|
|
|
129
131
|
import App from "./App.vue";
|
|
130
132
|
import mvframe from "mvframe";
|
|
131
133
|
import { pinia, store } from "mvframe/store";
|
|
132
|
-
import routes from "./router/
|
|
134
|
+
import routes from "./router/routes.js";
|
|
133
135
|
import appConfig from "./config/index.js";
|
|
134
136
|
import "./assets/style/index.scss";
|
|
135
137
|
import "mvframe/style";
|
|
@@ -152,7 +154,7 @@ const launchRouteGuard = (to, from, next) => {
|
|
|
152
154
|
return;
|
|
153
155
|
}
|
|
154
156
|
if (authed && to.name === "Entry") {
|
|
155
|
-
next({ name: "
|
|
157
|
+
next({ name: "Overview_Home", replace: true });
|
|
156
158
|
return;
|
|
157
159
|
}
|
|
158
160
|
next();
|
|
@@ -209,9 +211,10 @@ const isLoggedIn = computed(() => Boolean(launch.login));
|
|
|
209
211
|
);
|
|
210
212
|
|
|
211
213
|
write(
|
|
212
|
-
"src/router/
|
|
214
|
+
"src/router/routes.js",
|
|
213
215
|
`/**
|
|
214
|
-
*
|
|
216
|
+
* 与 mvframe \`demo/routes.js\` 一致:单文件导出全部路由;\`meta.public\` 为公开页(见 main.js 守卫)。
|
|
217
|
+
* B 嵌套使用 Layout + 子路由;日后若按权限裁剪菜单,可对本数组 \`filter\` 后再交给 Frame。
|
|
215
218
|
*/
|
|
216
219
|
export default [
|
|
217
220
|
{
|
|
@@ -223,49 +226,69 @@ export default [
|
|
|
223
226
|
public: true,
|
|
224
227
|
},
|
|
225
228
|
},
|
|
226
|
-
];
|
|
227
|
-
`,
|
|
228
|
-
);
|
|
229
|
-
|
|
230
|
-
write(
|
|
231
|
-
"src/router/adminRouter.js",
|
|
232
|
-
`/**
|
|
233
|
-
* 后台 / 业务路由(需登录后访问):可按接口权限过滤后追加,或整段替换。
|
|
234
|
-
* meta.admin 等字段可与 mvframe vueRouter.useAdmin / adminPermission 配合。
|
|
235
|
-
*/
|
|
236
|
-
export default [
|
|
237
229
|
{
|
|
238
|
-
path: "/
|
|
239
|
-
name: "
|
|
240
|
-
component: () => import("@/views/
|
|
230
|
+
path: "/overview",
|
|
231
|
+
name: "Overview_Home",
|
|
232
|
+
component: () => import("@/views/Overview/Home.vue"),
|
|
241
233
|
meta: {
|
|
242
|
-
title: "
|
|
234
|
+
title: "Overview",
|
|
243
235
|
},
|
|
244
236
|
},
|
|
245
237
|
{
|
|
246
|
-
path: "/
|
|
247
|
-
name: "
|
|
248
|
-
component: () => import("@/views/
|
|
238
|
+
path: "/a",
|
|
239
|
+
name: "A_Home",
|
|
240
|
+
component: () => import("@/views/A/Home.vue"),
|
|
249
241
|
meta: {
|
|
250
|
-
title: "
|
|
251
|
-
icon: "im-
|
|
252
|
-
// admin: true,
|
|
242
|
+
title: "A",
|
|
243
|
+
icon: "im-swap-right",
|
|
253
244
|
},
|
|
254
245
|
},
|
|
246
|
+
{
|
|
247
|
+
path: "/b",
|
|
248
|
+
name: "B_Home",
|
|
249
|
+
component: () => import("@/views/B/Layout.vue"),
|
|
250
|
+
meta: {
|
|
251
|
+
title: "B",
|
|
252
|
+
icon: "im-swap-right",
|
|
253
|
+
},
|
|
254
|
+
children: [
|
|
255
|
+
{ path: "", redirect: { name: "B_First" } },
|
|
256
|
+
{
|
|
257
|
+
path: "first",
|
|
258
|
+
name: "B_First",
|
|
259
|
+
component: () => import("@/views/B/First.vue"),
|
|
260
|
+
meta: { title: "B_First" },
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
path: "second",
|
|
264
|
+
name: "B_Second",
|
|
265
|
+
component: () => import("@/views/B/Second.vue"),
|
|
266
|
+
meta: { title: "B_Second" },
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
path: "third",
|
|
270
|
+
name: "B_Third",
|
|
271
|
+
component: () => import("@/views/B/Third.vue"),
|
|
272
|
+
meta: { title: "B_Third" },
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
path: "fourth",
|
|
276
|
+
name: "B_Fourth",
|
|
277
|
+
component: () => import("@/views/B/Fourth.vue"),
|
|
278
|
+
meta: { title: "B_Fourth" },
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
path: "fifth",
|
|
282
|
+
name: "B_Fifth",
|
|
283
|
+
component: () => import("@/views/B/Fifth.vue"),
|
|
284
|
+
meta: { title: "B_Fifth" },
|
|
285
|
+
},
|
|
286
|
+
],
|
|
287
|
+
},
|
|
255
288
|
];
|
|
256
289
|
`,
|
|
257
290
|
);
|
|
258
291
|
|
|
259
|
-
write(
|
|
260
|
-
"src/router/index.js",
|
|
261
|
-
`import baseRouter from "./baseRouter.js";
|
|
262
|
-
import adminRouter from "./adminRouter.js";
|
|
263
|
-
|
|
264
|
-
/** 交给 mvframe 的 vueRouter.routes(菜单与注册同源,无需拆两份维护) */
|
|
265
|
-
export default [...baseRouter, ...adminRouter];
|
|
266
|
-
`,
|
|
267
|
-
);
|
|
268
|
-
|
|
269
292
|
write(
|
|
270
293
|
"src/config/index.js",
|
|
271
294
|
`/**
|
|
@@ -357,7 +380,7 @@ defineOptions({
|
|
|
357
380
|
</Frame>
|
|
358
381
|
</template>
|
|
359
382
|
<script setup>
|
|
360
|
-
import routes from "@/router/
|
|
383
|
+
import routes from "@/router/routes.js";
|
|
361
384
|
|
|
362
385
|
defineOptions({
|
|
363
386
|
name: "AdminEntry",
|
|
@@ -417,7 +440,7 @@ const launch = store.launch();
|
|
|
417
440
|
|
|
418
441
|
const onSubmit = (payload) => {
|
|
419
442
|
launch.setLogin(payload ?? {});
|
|
420
|
-
router.replace({ name: "
|
|
443
|
+
router.replace({ name: "Overview_Home" }).catch(() => {});
|
|
421
444
|
};
|
|
422
445
|
|
|
423
446
|
/** 与 mvframe demo 一致:自定义提交字段名 account / pwd */
|
|
@@ -457,15 +480,18 @@ body {
|
|
|
457
480
|
);
|
|
458
481
|
|
|
459
482
|
write(
|
|
460
|
-
"src/views/
|
|
483
|
+
"src/views/Overview/Home.vue",
|
|
461
484
|
`<template>
|
|
462
|
-
<Page title="
|
|
463
|
-
<p
|
|
485
|
+
<Page title="Overview" subtitle="登录后默认首页,可替换为业务概览">
|
|
486
|
+
<p>
|
|
487
|
+
路由与 mvframe <code>demo/routes.js</code> 对齐:<code>/overview</code>、<code>/a</code>、<code>/b/...</code>;公开入口为
|
|
488
|
+
<code>routes.js</code> 中的 <code>Entry</code>。
|
|
489
|
+
</p>
|
|
464
490
|
</Page>
|
|
465
491
|
</template>
|
|
466
492
|
<script setup>
|
|
467
493
|
defineOptions({
|
|
468
|
-
name: "
|
|
494
|
+
name: "OverviewHome",
|
|
469
495
|
inheritAttrs: false,
|
|
470
496
|
});
|
|
471
497
|
</script>
|
|
@@ -478,18 +504,15 @@ code {
|
|
|
478
504
|
);
|
|
479
505
|
|
|
480
506
|
write(
|
|
481
|
-
"src/views/
|
|
507
|
+
"src/views/A/Home.vue",
|
|
482
508
|
`<template>
|
|
483
|
-
<Page title="
|
|
484
|
-
<p>
|
|
485
|
-
登录入口为 <code>baseRouter</code> 的 <code>Entry</code>(<code>meta.public</code>);业务路由见
|
|
486
|
-
<code>adminRouter.js</code>,合并于 <code>router/index.js</code>,与侧栏菜单同源。
|
|
487
|
-
</p>
|
|
509
|
+
<Page title="A" subtitle="一级业务模块示例">
|
|
510
|
+
<p>对应路由 <code>A_Home</code>,路径 <code>/a</code>。</p>
|
|
488
511
|
</Page>
|
|
489
512
|
</template>
|
|
490
513
|
<script setup>
|
|
491
514
|
defineOptions({
|
|
492
|
-
name: "
|
|
515
|
+
name: "AHome",
|
|
493
516
|
inheritAttrs: false,
|
|
494
517
|
});
|
|
495
518
|
</script>
|
|
@@ -501,6 +524,52 @@ code {
|
|
|
501
524
|
`,
|
|
502
525
|
);
|
|
503
526
|
|
|
527
|
+
write(
|
|
528
|
+
"src/views/B/Layout.vue",
|
|
529
|
+
`<template>
|
|
530
|
+
<Page title="B" subtitle="嵌套路由父级,子页在下方出口渲染">
|
|
531
|
+
<router-view />
|
|
532
|
+
</Page>
|
|
533
|
+
</template>
|
|
534
|
+
<script setup>
|
|
535
|
+
defineOptions({
|
|
536
|
+
name: "BLayout",
|
|
537
|
+
inheritAttrs: false,
|
|
538
|
+
});
|
|
539
|
+
</script>
|
|
540
|
+
`,
|
|
541
|
+
);
|
|
542
|
+
|
|
543
|
+
const bSubPages = [
|
|
544
|
+
["First", "B_First"],
|
|
545
|
+
["Second", "B_Second"],
|
|
546
|
+
["Third", "B_Third"],
|
|
547
|
+
["Fourth", "B_Fourth"],
|
|
548
|
+
["Fifth", "B_Fifth"],
|
|
549
|
+
];
|
|
550
|
+
for (const [file, routeTitle] of bSubPages) {
|
|
551
|
+
write(
|
|
552
|
+
`src/views/B/${file}.vue`,
|
|
553
|
+
`<template>
|
|
554
|
+
<Page title="${routeTitle}" subtitle="B 模块子路由">
|
|
555
|
+
<p>组件 <code>${file}</code>,路由名 <code>${routeTitle}</code>。</p>
|
|
556
|
+
</Page>
|
|
557
|
+
</template>
|
|
558
|
+
<script setup>
|
|
559
|
+
defineOptions({
|
|
560
|
+
name: "B${file}",
|
|
561
|
+
inheritAttrs: false,
|
|
562
|
+
});
|
|
563
|
+
</script>
|
|
564
|
+
<style lang="scss" scoped>
|
|
565
|
+
code {
|
|
566
|
+
font-size: 0.875rem;
|
|
567
|
+
}
|
|
568
|
+
</style>
|
|
569
|
+
`,
|
|
570
|
+
);
|
|
571
|
+
}
|
|
572
|
+
|
|
504
573
|
write("src/component/.gitkeep", "");
|
|
505
574
|
write("src/assets/img/.gitkeep", "");
|
|
506
575
|
write("src/composition/.gitkeep", "");
|
|
@@ -579,7 +648,19 @@ yarn install
|
|
|
579
648
|
|
|
580
649
|
## Launch(登录壳)
|
|
581
650
|
|
|
582
|
-
雏形与 **mvframe demo** 对齐:\`pinia/chip/launch.js\`(顶层 \`login\` + \`userinfo\`)、\`App.vue\`(\`<AdminEntry v-if />\` / \`<Entry v-else />\`)、\`main.js\` 内 \`import { store, pinia } from "mvframe/store"\` + \`launchRouteGuard\` + \`useAdmin\` / \`adminPermission\` / \`noaccess\`。未登录仅 \`meta.public\`;已登录进 \`Entry\` 会重定向到 \`
|
|
651
|
+
雏形与 **mvframe demo** 对齐:\`pinia/chip/launch.js\`(顶层 \`login\` + \`userinfo\`)、\`App.vue\`(\`<AdminEntry v-if />\` / \`<Entry v-else />\`)、\`main.js\` 内 \`import { store, pinia } from "mvframe/store"\` + \`launchRouteGuard\` + \`useAdmin\` / \`adminPermission\` / \`noaccess\`。未登录仅 \`meta.public\`;已登录进 \`Entry\` 会重定向到 \`Overview_Home\`(\`/overview\`)。若不需门禁,将 \`useAdmin\` 改为 \`false\` 并删除 \`adminPermission\` 与 \`noaccess\`。
|
|
652
|
+
|
|
653
|
+
## 路由(与 mvframe \`demo/routes.js\` 对齐)
|
|
654
|
+
|
|
655
|
+
| 路由名 | 路径 | 说明 |
|
|
656
|
+
|--------|------|------|
|
|
657
|
+
| \`Entry\` | \`/\` | 登录,\`meta.public\` |
|
|
658
|
+
| \`Overview_Home\` | \`/overview\` | 登录后默认页 |
|
|
659
|
+
| \`A_Home\` | \`/a\` | 一级模块示例 |
|
|
660
|
+
| \`B_Home\` | \`/b\` | 嵌套父级(\`Layout.vue\` + \`router-view\`) |
|
|
661
|
+
| \`B_First\` … \`B_Fifth\` | \`/b/first\` … | 子路由 |
|
|
662
|
+
|
|
663
|
+
路由集中在 \`src/router/routes.js\`(与 demo 单文件一致);\`Frame\` 的 \`menu.routes\` 由该表筛选掉 \`meta.public\` 后与注册同源。
|
|
583
664
|
|
|
584
665
|
### 报错 \`Could not resolve '@vue/shared'\`
|
|
585
666
|
|
|
@@ -606,9 +687,9 @@ yarn install
|
|
|
606
687
|
| \`src/api\` | 接口 |
|
|
607
688
|
| \`src/assets/style\` | 样式入口,main.js 已 import |
|
|
608
689
|
| \`src/assets/img\` | 静态图 |
|
|
609
|
-
| \`src/router/
|
|
610
|
-
| \`src/
|
|
611
|
-
| \`src/
|
|
690
|
+
| \`src/router/routes.js\` | 全部路由(与 \`demo/routes.js\` 结构一致)→ \`vueRouter.routes\` |
|
|
691
|
+
| \`src/views/Launch/*\` | 登录壳与登录页 |
|
|
692
|
+
| \`src/views/Overview\`、\`A\`、\`B\` | 与路由表一一对应的页面 |
|
|
612
693
|
| \`src/pinia/chip/*.js\` | 业务 store → \`storeChips: import.meta.glob(...)\` |
|
|
613
694
|
| \`src/config/index.js\` | 合并进 \`globalThis.$config\` |
|
|
614
695
|
| \`src/composition\` | 可选,与 Vite 别名 \`@cps\` 对应 |
|