this.$router跳转 带参数

不带参数

this.$router.push('/xqgl/ysjhgl/cjysjh'); //  路径:'/xqgl/ysjhgl/cjysjh'

带参数

this.$router.push({name: 'Ysjhdetail', params: {num_id: val}}); // 路径名name

参数获取

created() {
    this.pkid = this.$route.params.num_id;
}

routes.js文件

import Ysjhdetail from '../views/xqgl/ysjhgl/Ysjhdetail.vue'

let routes = {
    path: '/xqgl/ysjhgl/ysjhdetail',
    component: Ysjhdetail,
    name: 'Ysjhdetail' 
}

export default routes;

你可能感兴趣的:(Vue)