赞
踩
1.axios的get请求传参、、、.axios中delete数据请求和get的请求方式是一样的
- // axios.get('http://localhost:3000/axios?id=123').then(function(ret){
- // console.log(ret.data)
- // })
- // axios.get('http://localhost:3000/axios/123').then(function(ret){
- // console.log(ret.data)
- // })
- // axios.get('http://localhost:3000/axios', {
- // params: {
- // id: 789
- // }
- // }).then(function(ret){
- // console.log(ret.data)
- // })
- get请求传参参数可以拼接在地址栏中进行传递,同当要传递的参数是一个对象的时候,可以使用第三中的传递方式,将传输对象放在一个对象当中,同时作为属性为params的属性值进行传递
2,axios中post和put请求数据参数的传递
- // axios.post('http://localhost:3000/axios', {
- // uname: 'lisi',
- // pwd: 123
- // }).then(function(ret){
- // console.log(ret.data)
- // })
- // var params = new URLSearchParams();
- // params.append('uname', 'zhangsan');
- // params.appen
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。