向後臺發送數據vue
阿新 • • 發佈:2018-04-09
response hat 數據 引入 orm resp post function app
在main.js中添加
import axios from ‘axios‘;
Vue.prototype.$http = axios;
在需要的登錄vue組件中引入:
需要先安裝qs cnpm install qs -d
import qs from ‘qs‘
最後
this.$http.post(‘http://tapi.funxdata.com/login/login‘, qs.stringify({ ‘type‘:‘wechat‘, ‘code‘:res.code }),{ headers: {‘Content-Type‘: ‘application/x-www-form-urlencoded;charset=UTF-8‘ } }).then(function (response) { console.log(response); }).catch(function (error) { console.log(error); });
向後臺發送數據vue