如果是电脑访问 is-mobile 页面的话 跳转到首页

Former-commit-id: b69892d584c0d90e74afc65f3a0f5aa72d7a8902 [formerly b69892d584c0d90e74afc65f3a0f5aa72d7a8902 [formerly b69892d584c0d90e74afc65f3a0f5aa72d7a8902 [formerly b69892d584c0d90e74afc65f3a0f5aa72d7a8902 [formerly c96c92f194844b48a638d03aea3c3f841a2d4ae0 [formerly 02b02df6ba1d89008d69fb1c029279863b039845]]]]]
Former-commit-id: 7e9989ba1ce54e84804ff3de09dba15d7260222b
Former-commit-id: 3b964378c169dcbe2f9aeaae639ee6120f2f5451
Former-commit-id: 1d2b7d44b33c568d02a42b510b50f8592c2d2c06 [formerly 88d3c50c4664c178e310ec482bfc29c1927922ad]
Former-commit-id: c65f5b27cf2c5ac2c4dbdbc746cd76e7ef61fbb1
Former-commit-id: 792eab1a332813861f486bebadcc759ed2f94fa0
Former-commit-id: 2f2aac48b2895a16071d09a0842e0aacff16d272
Former-commit-id: 28f2651336d25e04d944c3fdd42cd3f1ce3e8a0f
Former-commit-id: 7195e2683708e918a446774c22949d59d5e125b0
This commit is contained in:
liyang
2018-07-18 11:18:36 +08:00
parent 1e3fdc9294
commit 9fa02a7b60

View File

@@ -21,6 +21,11 @@ router.beforeEach((to, from, next) => {
next({ name: 'is-mobile' }) next({ name: 'is-mobile' })
return return
} }
// 如果是电脑访问 is-mobile 页面的话 跳转到首页
if (to.name === 'is-mobile' && !util.isMobile()) {
next({ name: 'index' })
return
}
// 验证当前路由所有的匹配中是否需要有登陆验证的 // 验证当前路由所有的匹配中是否需要有登陆验证的
if (to.matched.some(r => r.meta.requiresAuth)) { if (to.matched.some(r => r.meta.requiresAuth)) {
// 这里暂时将cookie里是否存有token作为验证是否登陆的条件 // 这里暂时将cookie里是否存有token作为验证是否登陆的条件