VUE 页面的跳转写法

来源:互联网 发布:0基础自学英语软件 编辑:程序博客网 时间:2024/05/22 04:58

在VUE中, 页面的跳转写法

在ajax 请求外写上

let _this = this;

在要跳转的地方写

 _this.$router.push({
     name: 'index'
 })

,

如果没有ajax请求,也可以直接写


this.$router.push({
       name: 'index'

 })

这里 'index' 指在 router-map.js 中 定义的    name:'index',

const routes = [    {        path: '/',        name: 'index',        meta: {            title: '样衣管理'        },        component: resolve => require(['./components/index.vue'], resolve)    },
       ....

]

原创粉丝点击