a.vue向b.vue传值

a.vue
this.$router.push({
path: '/payType',
query: {
putUpList: this.putUpList,
name:''
},
params:{
cartList: this.cartList,
totalMoney: this.totalMoney
}
}); b.vue
mounted:function(){
console.log(this.$route.params)
console.log(this.$route.query)
} 坑来了
query可以拿到,params拿不到
需要在注册路由的地方给路由加上name参数
const router = new VueRouter({
routes:[{
...
},{
path:'/payType',
name:'inputComp',
component: payType
}]
}) a.vue跳转路由的地方同样加上name参数,b.vue就可以拿到params了
this.$router.push({
path: '/payType',
name: 'inputComp',
query: {
putUpList: this.putUpList,
name:''
},
params:{//一定要设置name,才可以传params
cartList: this.cartList,
totalMoney:this.totalMoney
}
});

转载:https://www.cnblogs.com/matd/p/11573819.html

vue 路由跳转带参 方式query ,params的更多相关文章

  1. 详解vue 路由跳转四种方式 (带参数)

    详解vue 路由跳转四种方式 (带参数):https://www.jb51.net/article/160401.htm 1.  router-link ? 1 2 3 4 5 6 7 8 9 10 ...

  2. vue路由(一个包含重定向、嵌套路由、懒加载的main.js如下)and 路由跳转传参的query和params的异同

    import Vue from 'vue'import VueRouter from 'vue-router'import App from './App'Vue.use(VueRouter)cons ...

  3. vue路由跳转的多种方式

    1.router-link to 跳转 <router-link to="/child"><button>跳转</button></rou ...

  4. vue路由跳转传参的两种方法

    路由跳转: this.$router.push({ name: '工单列表', params: {p_camera_dev_name: 'xxx'} }); 使二级菜单呈点击状态: $('[index ...

  5. vue 路由跳转传参

    <li v-for="article in articles" @click="getDescribe(article.id)"> getDescr ...

  6. vue路由跳转传参

    this.$router.push({ path: '/message/result_notice', query: { id: id } }) // let type = this.$route.n ...

  7. vue路由跳转的方式

    vue路由跳转有四种方式 1. router-link 2. this.$router.push() (函数里面调用) 3. this.$router.replace() (用法同push) 4. t ...

  8. Vue之路由跳转 传参 aixos 和cookie

    一.路由跳转 1.1 项目的初始化 vue create m-proj   >>>创建vue项目 精简vue项目的 views 视图   About(基本是删除的) Home.(可以 ...

  9. Vue Router路由导航及传参方式

    路由导航及传参方式 一.两种导航方式 ①:声明式导航 <router-link :to="..."> ②:编程式导航 router.push(...) 二.编程式导航参 ...

随机推荐

  1. SSL证书创建与部署

    SSL证书简介SSL证书创建SSL证书部署-NginxSSL证书部署-ApacheSSL证书部署-Tomcat SSL简介以及发展SSL协议原理SSL应用场景 SSL简介以及发展传输层安全性协议,以及 ...

  2. Axure9 9.0.0.3648 秘钥亲测可用

    用户名: thisProEdition秘钥:PkgeOGle9dSCMXTAczSrTGQZJLcviUJO1kG6onDIH/C68b+AUItWKdbBrmkJsJ0m

  3. centos7 出现“FirewallD is not running”

    原因:没有开启防火墙 #提示没有开启防火墙服务,–permanent #永久生效,没有此参数重启后失效 [root@uJZ ~]# firewall-cmd --permanent --zone=/t ...

  4. shell 命令行参数(基本)

    命令行参数 $0 表示程序名.$1 至 \$9则是位置参数.$# 表示参数的个数.$* 将所有参数当做一个整体来引用$@ 把每个参数作为一个字符串返回,可以使用for循环来遍历$? 最近一个执行的命令 ...

  5. maven 左边空了

    看一下maven: 解决方法:进入maven的配置,把maven的路径配置一下,就好了: 结果:

  6. mybatis-generator 模板

    generatorConfig.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ge ...

  7. TypeScript in 5 minutes

    https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html Let’s get started by build ...

  8. Mybatis的if标签判断空字符串 == 0,参数为0时会自动转为空字符串

    对于这个问题,有两种解决办法. 1.当传入的参数有0时,只判断!=null即可. 2.将0转化为String类型,就可以解决这个问题.

  9. JVM探究之 —— 垃圾回收(二)

    1. 垃圾收集算法 1.1 标记清除(Mark-Sweep)算法 标记—清除算法是第一种使用和比较完善的垃圾回收算法,后续的收集算法都是基于其设计思路并对其不足进行改进而得到的. 该算法分为“标记”和 ...

  10. -[UITableView copyWithZone:]: unrecognized selector sent to instance 0x7XXXXXX00

    -[UITableView copyWithZone:]: unrecognized selector sent to instance 0x7XXXXXX00 -[Class copyWithZon ...