Skip to content

Commit 29f1e11

Browse files
fix redirect bug
1 parent cea1204 commit 29f1e11

File tree

5 files changed

+26
-5
lines changed

5 files changed

+26
-5
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# Quasar Project (quasar-vue3-admin-template)
22

33
Use **vue-facing-decorator(Class syntax)** to Write Vue3 , discard setup syntax , embrace OOP , try my self do it
4+
Support vue multi-page, a vue project can have multiple html entry
45

56
### Vue3 Class syntax online preview https://dirkhe1051931999.github.io/v3-admin
67

8+
### multi-page demo https://dirkhe1051931999.github.io/v3-admin/pageA.html#/large-display
9+
710
### Vue2 Class syntax preview https://dirkhe1051931999.github.io/quasar
811

912
#### Login

multi.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ let config = {
33
// 在src/pages下要有对应的js文件
44
app: {
55
pageA: {
6-
title: '我是pageA',
7-
description: '我是pageA的description',
6+
title: 'multi-page',
7+
description: 'multi-page description',
88
},
99
},
1010
};

quasar.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ module.exports = configure(function (ctx) {
9393
...cfg.resolve.alias,
9494
src2: path.resolve(__dirname, './src2'),
9595
};
96-
cfg.entry = Object.assign(cfg.entry, multiplePage.getEntryPages());
96+
cfg.entry = Object.assign(multiplePage.getEntryPages(), cfg.entry);
9797
cfg.plugins.push(...multiplePage.htmlPlugins());
9898
},
9999
},

src/router/routes.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ import { PermissionModule } from 'src/store/modules/permission';
2020
function redirect(to: any) {
2121
const routes = PermissionModule.routes;
2222
return `${routes[1].path}${
23-
routes[1] && routes[1].children && routes[1].children![0].path ? '/' : ''
23+
routes[1] && routes[1].children && routes[1].children![0].path
24+
? '/dashboard'
25+
: ''
2426
}`;
2527
}
2628
export const constantRoutes: RouteRecordRaw[] = [
@@ -629,7 +631,10 @@ export const asyncRoutes: RouteRecordRaw[] = [
629631
name: 'largeDisplay0',
630632
children: [
631633
{
632-
path: `${location.origin}/pageA.html#/large-display`,
634+
path:
635+
process.env.NODE_ENV === 'production'
636+
? `${location.origin}/v3-admin/pageA.html#/large-display`
637+
: `${location.origin}/pageA.html#/large-display`,
633638
component: () => {},
634639
name: 'largeDisplay',
635640
meta: {

src2/router/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
import { createRouter, createWebHashHistory } from 'vue-router';
2+
function redirect(to) {
3+
location.replace(
4+
process.env.NODE_ENV === 'production'
5+
? '/v3-admin/index.html#/dashboard'
6+
: 'index.html#/dashboard'
7+
);
8+
}
9+
210
const routes = [
11+
{
12+
path: '/',
13+
name: 'Home',
14+
redirect: redirect,
15+
},
316
{
417
path: '/large-display',
518
name: 'LargeDisplay',

0 commit comments

Comments
 (0)