javascript - vue刷新跳转首页
本文介绍了javascript - vue刷新跳转首页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
一刷新就跳首页
main.js
const router = new VueRouter({
history: false,
hashbang: true,
routes
})
router.js
const routers = [
{
path:'/login',
component:login,
},
{
path: '/welcome',
component: welcome,
},
{
path: '/test',
component: test,
},
{
path: '/',
component: Home,
children: [
{ path: '/clueFilter', component: clueFilter, name: '首页'},
{ path: '/myTags', component: myTags, name: '我的'},
]
},
{
path: '/',
component: Home,
children: [
{ path: '/statistics',component: statistics, name: '下载记录'},
{ path: '/tableHistory', component:tableHistory,name: '已下载'},
{ path: '', name: '业务分析',permissions:'vip'}
]
}
]
app.vue
export default {
name: 'app',
components: {
},
created: function () {
this.$router.push('/login')
}
}
不管在哪页刷新,就一直跳转login页,是否我设置初始页面的方式有问题?
解决方案
仔细翻阅官方文档。。用redirect指向首页,而不是直接push。
这篇关于javascript - vue刷新跳转首页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文