vue路由怎么跳转一个新的页面

clipboard.png

现在页面已经渲染了这个单文件组件,其中111这个链接就是跳转规则但是这样点击就内容就会在这个组件中渲染。怎么才能让他跳转到一个新的页面???

阅读 5.7k
3 个回答

配置路由指向一个空白页面,在空白页面中挂载视图组件。可以达到效果。
index.vue

<template>
    <transition name="router-fade" mode="out-in">
        <router-view></router-view>
    </transition>
</template>

router.js

export default [{
    path: '/',
    component: App,
    children: [
        {path: '', component:index},
        {path: 'orderDetail', component:orderDetail}
    ]
}];

你可以点击tab时用v-if控制下面的模块显示与隐藏呀

把<router-view></router-view>放到最外层组件

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题