vue-router传参数(get和post方式)
来源:互联网 发布:去蓝光软件 编辑:程序博客网 时间:2024/06/05 19:00
vue-router传参数(get和post方式)
本文主要介绍vue-router传参数的两种方式:
1、get方式
页面跳转
this.$router.push({path:'/xxx',query:{id:1}});//类似get传参,通过URL传递参数
新页面接收参数
this.$route.query.id
2、post方式
页面跳转
//由于动态路由也是传递params的,所以在 this.$router.push() 方法中 path不能和params一起使用,否则params将无效。
需要用name来指定页面。 this.$router.push({name:'page2',params:{id:1}});//类似post传参
新页面接收参数
this.$route.params.id
3、注意:在页面进行刷新的时候经常会遇到参数变了,但是新页面接受的参数没有变化。这种问题可以通过加watch解决。
watch: { '$route'(to, from){ //在这里重新刷新一下 this.getParams(); } }
阅读全文
0 0
- vue-router传参数(get和post方式)
- 参数传递中的编码问题(get和post方式)
- 参数传递中的编码问题(get和post方式)
- 参数传递中的编码问题(get和post方式)
- GET和POST方式传递参数
- GET和POST方式传递参数
- 01- GET和POST方式传递参数
- GET和POST方式
- router get post all
- 使用Post和Get方式传输HTTP参数
- request请求获取参数(post和get两种方式)
- Ajax 传中文参数乱码问题(Post和Get方式)
- 通过GET和POST方式提交参数给web应用
- 通过get和post方式提交参数给web应用
- Express框架中Get和Post方式取参数
- request请求获取参数(post和get两种方式)
- http传递参数信息和传递方式post、get
- Get方式和Post方式
- 深入JVM内核—原理与优化之gc参数学习
- 汉诺塔1
- ActiveMQ消息队列
- java基础第四讲JavaScript详解
- 汉诺塔2
- vue-router传参数(get和post方式)
- SQLite jdbc 单例
- IDEA错误:Cannot start compilation: the output path is not specified for module "Test". (转)
- 汉诺塔3
- Python学习之Numpy
- 深入JVM内核—原理与优化之六类加载器
- 12、Oracle的子查询
- 汉诺塔4
- 机器学习基石-05-3-Effective Number of Hypotheses