0

一刷新就跳首页

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页,是否我设置初始页面的方式有问题?

查看全部 4 个回答

0

已采纳

仔细翻阅官方文档。。用redirect指向首页,而不是直接push。