zoukankan      html  css  js  c++  java
  • vue 路由配置

    1.不带参数的路由配置 及 跳转

    //路由配置:

    {

    name: "a",
    path: "/a",
    component: a
    }
     
    页面跳转:
    this.$router.push('/a');  
    this.$router.push({path:'/a'});
    this.$router.push({name:'a'})
     
    2.带参数的路由配置及页面跳转 和 接收参数

    //路由配置:

    {

    name: "a",
    path: "/a/:userid",
    component: a
    }
    //页面跳转:
    this.$router.push({name:'a',params:{userid:123}});    接收: this.$route.params.userid
    this.$router.push({path:'/a',params:{userid:123}})   错误,如果提供了 pathparams 会被忽略
    this.$router.push({path:'/a/123'});                             接收: this.$route.params.userid
     
    this.$router.push({path:'/a?userid=123'})  接收:this.$route.query.userid  ----- 这一项的路由配置 path:'/a' ,不用带参数
     this.$router.push({path:'/a',query:{userid:123}})         接收: this.$route.query.userid ----- 这一项的路由配置 path:'/a' ,不用带参数
     
     
     
     
     
     
  • 相关阅读:
    python opencv PyQt5
    各大web服务器https的证书文件
    mysql 常用字符串操作
    python 修改字符串中的某一位字符
    python mysql
    小程序
    m4a 转MP3
    安装python 3.7
    树莓派版本信息
    bash 重启后台程序脚本
  • 原文地址:https://www.cnblogs.com/mili3/p/8983905.html
Copyright © 2011-2022 走看看