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. Linux禁止ping和开启ping的方法

    Linux默认是允许Ping响应的,系统是否允许Ping由2个因素决定的:A.内核参数,B.防火墙,需要2个因素同时允许才能允许Ping,2个因素有任意一个禁Ping就无法Ping.   一.通过修改 ...

  2. ModuleNotFoundError: No module named 'suit'

    ModuleNotFoundError: No module named 'suit' pip3. install suit

  3. 【Gamma】Scrum Meeting 1 & 与助教谈话

    前言 Gamma阶段第1次会议在5月26日22:00由PM在大运村一公寓三层召开, 时长30min. 任务分配 姓名 今日任务 明日任务 困难 周博闻 用户控制器解耦和注释 用户控制器解耦和注释 周国 ...

  4. 【Beta阶段】第八次Scrum Meeting

    每日任务内容 队员 昨日完成任务 明日要完成的任务 张圆宁 #63 技术博客--django和mysqlhttps://github.com/rRetr0Git/rateMyCourse/issues ...

  5. 站在BERT肩膀上的NLP新秀们(PART I)

    站在BERT肩膀上的NLP新秀们(PART I)

  6. BaiduPCS-Go的安装及使用

    BaiduPCS-Go的安装及使用 linux下会提示输入验证码,浏览器打开验证码url,多输入几次 Contents [hide] 一. 软件下载及安装 二. 软件的使用 1. 账号登录与退出 2. ...

  7. windows7平台android studio新建Android项目,报错

    Failed to install the following Android SDK packages as some licences have not been accepted. platfo ...

  8. 华为交换机在Telnet登录下自动显示接口信息

    因为用console连接交换机,默认是自动显示接口信息的,比如down掉一个接口后,会自动弹出接口被down掉的信息,但是在telnet连接下,默认是不显示这些信息的,需要开启后才可显示. 1.首先开 ...

  9. Java jsoup获取网页中的图片

    获取图片 package com.vfsd.net; import java.io.File; import java.io.FileOutputStream; import java.io.IOEx ...

  10. 第一本docker书 学习笔记(二)

    #安装docker的先决条件 运行64位CPU构架的计算机(docker目前不支持32位的cpu) 运行LUFSinux3.8或者更高版本内核 内核必须支持一种合适的存储驱动,例如: device M ...