vue-router params 和 query 的区别

params 和 query 实际上用法是相似的,parmas 常用于动态路由的传值,而query是通过 ? 把参数拼接到路由上跟 GIT 请求同理

params 用法

this.$router.push({ 
      name: "xx", //路由名称
      params: {
        // xxx 参数
      }
    });

query 用法

this.$router.push({ 
      name: "xx", //路由名称
      query: {
        // xxx 参数
      }
    });

猜你喜欢

转载自www.cnblogs.com/fczbk/p/12395307.html
今日推荐