VUE2 Axios Post form
2018-09-08 09:43
357 查看
1. 在router.js中增加如下内容
import Axios from 'axios' import qs from 'qs' Axios.interceptors.request.use( (config) => { if (config.method=="post"){ config.data = qs.stringify(config.data) config.headers['Content-Type'] = 'application/x-www-form-urlencoded' } return config }, (error) => { return Promise.reject(error) });
2. 使用post提交
Axios.post(url', {tid: params.rowData.id}) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); });
相关文章推荐
- vue axios POST请求中参数以form data和request payload形式的原因
- vue2使用axios post跳坑,封装成模块
- Axios 里 post formdata 的数据跟jquery中formdata数据格式不一样
- axios post请求数据,在Content-Type为application/x-www-form-urlencoded情况下,data如何转换为json的解决办法
- Vue axios post请求
- IONIC3问题:post传错值数据库错误,form-data和request payload
- html5 中form表单post与get方法的区别
- FORM表单不刷新提交POST数据
- Simulate a Form POST Request Using WinInet
- Vue------用axios发送post请求自动set cookie
- javascript 跨域POST 使用form表单 获取提交返回内容的方法
- .post简化.ajax方式提交form表单
- Javascript模拟FORM以POST方式提交表单数据
- 非FORM格式,使用POST方式向servlet发送请求
- axios 将post请求数据转为formdata
- 根据,一次完整的http 请求过程,谈1 form提交中的post提交 2http url(即ip地址中的地址)在整个http请求中的作用
- vue中使用axios post上传头像/图片并实时显示到页面的方法
- Post Form Urlencoded HttpEntity
- Django开发中form表单post提交出现403问题解决
- PHP Curl进行Post时指定 multipart/form-data 或 application/x-www-form-urlencoded 的方法