Skip to content

Commit f69a7c3

Browse files
committed
fix: router redirect
1 parent ddd32af commit f69a7c3

File tree

2 files changed

+111
-111
lines changed

2 files changed

+111
-111
lines changed

src/components/page/PageHeader.vue

Lines changed: 109 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
<div class="page-header-index-wide">
44
<a-breadcrumb class="breadcrumb">
55
<a-breadcrumb-item v-for="(item, index) in breadList" :key="index">
6-
<router-link v-if="item.name != name" :to="{ path: item.path }">
7-
{{ item.meta.title }}
8-
</router-link>
6+
<router-link
7+
v-if="item.name != name && index != 1"
8+
:to="{ path: item.path === '' ? '/' : item.path }"
9+
>{{ item.meta.title }}</router-link>
910
<span v-else>{{ item.meta.title }}</span>
1011
</a-breadcrumb-item>
1112
</a-breadcrumb>
@@ -34,7 +35,6 @@
3435
<slot name="pageMenu"></slot>
3536
</div>
3637
</div>
37-
3838
</div>
3939
</div>
4040
</div>
@@ -80,7 +80,7 @@ export default {
8080
this.getBreadcrumb()
8181
},
8282
methods: {
83-
getBreadcrumb () {
83+
getBreadcrumb () {
8484
this.breadList = []
8585
// this.breadList.push({name: 'index', path: '/dashboard/', meta: {title: '首页'}})
8686
@@ -101,137 +101,136 @@ export default {
101101

102102
<style lang="less" scoped>
103103
104-
.page-header {
105-
background: #fff;
106-
padding: 16px 32px 0;
107-
border-bottom: 1px solid #e8e8e8;
104+
.page-header {
105+
background: #fff;
106+
padding: 16px 32px 0;
107+
border-bottom: 1px solid #e8e8e8;
108108
109-
.breadcrumb {
110-
margin-bottom: 16px;
111-
}
109+
.breadcrumb {
110+
margin-bottom: 16px;
111+
}
112112
113-
.detail {
114-
display: flex;
115-
/*margin-bottom: 16px;*/
113+
.detail {
114+
display: flex;
115+
/*margin-bottom: 16px;*/
116116
117-
.avatar {
118-
flex: 0 1 72px;
119-
margin: 0 24px 8px 0;
120-
121-
& > span {
122-
border-radius: 72px;
123-
display: block;
124-
width: 72px;
125-
height: 72px;
126-
}
117+
.avatar {
118+
flex: 0 1 72px;
119+
margin: 0 24px 8px 0;
120+
121+
& > span {
122+
border-radius: 72px;
123+
display: block;
124+
width: 72px;
125+
height: 72px;
127126
}
127+
}
128128
129-
.main {
130-
width: 100%;
131-
flex: 0 1 auto;
129+
.main {
130+
width: 100%;
131+
flex: 0 1 auto;
132132
133-
.row {
134-
display: flex;
135-
width: 100%;
133+
.row {
134+
display: flex;
135+
width: 100%;
136136
137-
.avatar {
138-
margin-bottom: 16px;
139-
}
137+
.avatar {
138+
margin-bottom: 16px;
140139
}
140+
}
141141
142-
.title {
143-
font-size: 20px;
144-
font-weight: 500;
142+
.title {
143+
font-size: 20px;
144+
font-weight: 500;
145145
146-
font-size: 20px;
147-
line-height: 28px;
148-
font-weight: 500;
149-
color: rgba(0,0,0,.85);
150-
margin-bottom: 16px;
151-
flex: auto;
146+
font-size: 20px;
147+
line-height: 28px;
148+
font-weight: 500;
149+
color: rgba(0,0,0,.85);
150+
margin-bottom: 16px;
151+
flex: auto;
152152
153-
}
154-
.logo {
155-
width: 28px;
156-
height: 28px;
157-
border-radius: 4px;
158-
margin-right: 16px;
159-
}
160-
.content, .headerContent {
161-
flex: auto;
162-
color: rgba(0,0,0,.45);
163-
line-height: 22px;
164-
165-
.link {
166-
margin-top: 16px;
167-
line-height: 24px;
168-
169-
a {
170-
font-size: 14px;
171-
margin-right: 32px;
172-
}
153+
}
154+
.logo {
155+
width: 28px;
156+
height: 28px;
157+
border-radius: 4px;
158+
margin-right: 16px;
159+
}
160+
.content, .headerContent {
161+
flex: auto;
162+
color: rgba(0,0,0,.45);
163+
line-height: 22px;
164+
165+
.link {
166+
margin-top: 16px;
167+
line-height: 24px;
168+
169+
a {
170+
font-size: 14px;
171+
margin-right: 32px;
173172
}
174173
}
175-
.extra {
176-
flex: 0 1 auto;
177-
margin-left: 88px;
178-
min-width: 242px;
179-
text-align: right;
180-
}
181-
.action {
182-
margin-left: 56px;
183-
min-width: 266px;
184-
flex: 0 1 auto;
185-
text-align: right;
186-
&:empty {
187-
display: none;
188-
}
174+
}
175+
.extra {
176+
flex: 0 1 auto;
177+
margin-left: 88px;
178+
min-width: 242px;
179+
text-align: right;
180+
}
181+
.action {
182+
margin-left: 56px;
183+
min-width: 266px;
184+
flex: 0 1 auto;
185+
text-align: right;
186+
&:empty {
187+
display: none;
189188
}
190189
}
191190
}
192191
}
192+
}
193193
194-
.mobile .page-header {
194+
.mobile .page-header {
195195
196-
.main {
196+
.main {
197197
198-
.row {
199-
flex-wrap: wrap;
198+
.row {
199+
flex-wrap: wrap;
200200
201-
.avatar {
202-
flex: 0 1 25%;
203-
margin: 0 2% 8px 0;
204-
}
205-
.content, .headerContent {
206-
flex: 0 1 70%;
201+
.avatar {
202+
flex: 0 1 25%;
203+
margin: 0 2% 8px 0;
204+
}
205+
.content, .headerContent {
206+
flex: 0 1 70%;
207207
208-
.link {
209-
margin-top: 16px;
210-
line-height: 24px;
208+
.link {
209+
margin-top: 16px;
210+
line-height: 24px;
211211
212-
a {
213-
font-size: 14px;
214-
margin-right: 10px;
215-
}
212+
a {
213+
font-size: 14px;
214+
margin-right: 10px;
216215
}
217216
}
218-
.extra {
219-
flex: 1 1 auto;
220-
margin-left: 0;
221-
min-width: 0;
222-
text-align: right;
223-
}
224-
.action {
225-
margin-left: unset;
226-
min-width: 266px;
227-
flex: 0 1 auto;
228-
text-align: left;
229-
margin-bottom: 12px;
230-
&:empty {
231-
display: none;
232-
}
217+
}
218+
.extra {
219+
flex: 1 1 auto;
220+
margin-left: 0;
221+
min-width: 0;
222+
text-align: right;
223+
}
224+
.action {
225+
margin-left: unset;
226+
min-width: 266px;
227+
flex: 0 1 auto;
228+
text-align: left;
229+
margin-bottom: 12px;
230+
&:empty {
231+
display: none;
233232
}
234233
}
235234
}
236235
}
237-
</style>
236+
</style>

src/config/router.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const asyncRouterMap = [
4343
// forms
4444
{
4545
path: '/form',
46-
redirect: '/form/basic-form',
46+
redirect: '/form/base-form',
4747
component: PageView,
4848
meta: { title: '表单页', icon: 'form', permission: [ 'form' ] },
4949
children: [
@@ -258,6 +258,7 @@ export const asyncRouterMap = [
258258
{
259259
path: '/account',
260260
component: RouteView,
261+
redirect: '/account/center',
261262
name: 'account',
262263
meta: { title: '个人页', icon: 'user', keepAlive: true, permission: [ 'user' ] },
263264
children: [

0 commit comments

Comments
 (0)