Skip to content

Commit 66919b3

Browse files
committed
react: Login success not enter $router onComplete
1 parent fb3f922 commit 66919b3

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/views/user/Login.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,25 @@ export default {
250250
},
251251
loginSuccess (res) {
252252
console.log(res)
253-
this.$router.push({ name: 'dashboard' }, () => {
253+
// check res.homePage define, set $router.push name res.homePage
254+
// Why not enter onComplete
255+
/*
256+
this.$router.push({ name: 'analysis' }, () => {
257+
console.log('onComplete')
254258
this.$notification.success({
255259
message: '欢迎',
256260
description: `${timeFix()},欢迎回来`
257261
})
258262
})
263+
*/
264+
this.$router.push({ name: 'analysis' })
265+
// 延迟 1 秒显示欢迎信息
266+
setTimeout(() => {
267+
this.$notification.success({
268+
message: '欢迎',
269+
description: `${timeFix()},欢迎回来`
270+
})
271+
}, 1000)
259272
this.isLoginError = false
260273
},
261274
requestFailed (err) {

0 commit comments

Comments
 (0)