-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.ts
More file actions
79 lines (75 loc) · 2.02 KB
/
plugin.ts
File metadata and controls
79 lines (75 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import type { IApi } from '@winner-fed/winjs';
import { getBuildTime } from './build/time';
// import type { RouteMeta } from 'vue-router';
// const ElegantVueRouter = require('@elegant-router/vue/webpack');
// import type { RouteKey } from '@elegant-router/types';
export default (api: IApi) => {
api.modifyHTML(($) => {
return $;
});
// meta 添加缓存参数
api.addHTMLMetas(() => [
{
'http-equiv': 'Cache-Control',
content: 'no-store, no-cache, must-revalidate'
},
{
'http-equiv': 'Pragma',
content: 'no-cache'
},
{
'http-equiv': 'Expires',
content: '0'
},
{
'name': 'color-schema',
content: 'light dark'
},
{
'name': 'buildTime',
content: `${getBuildTime()}`
}
]);
// 自动生成路由
// api.modifyWebpackConfig((memo) => {
// memo.plugins = (memo.plugins || []).concat(
// ElegantVueRouter({
// layouts: {
// base: 'src/layouts/base-layout/index.vue',
// blank: 'src/layouts/blank-layout/index.vue'
// },
// routePathTransformer(routeName, routePath) {
// const key = routeName as RouteKey;
//
// if (key === 'login') {
// const modules: UnionKey.LoginModule[] = ['pwd-login', 'code-login', 'register', 'reset-pwd', 'bind-wechat'];
//
// const moduleReg = modules.join('|');
//
// return `/login/:module(${moduleReg})?`;
// }
//
// return routePath;
// },
// onRouteMetaGen(routeName) {
// const key = routeName as RouteKey;
//
// const constantRoutes: RouteKey[] = ['login', '403', '404', '500'];
//
// const meta: Partial<RouteMeta> = {
// title: key,
// i18nKey: `route.${key}` as App.I18n.I18nKey
// };
//
// if (constantRoutes.includes(key)) {
// meta.constant = true;
// }
//
// return meta;
// }
// })
// );
//
// return memo;
// });
};