vue & axios
1:npm install axios
2:在main.js引入
import axios from 'axios'
Vue.prototype.axios = axios
3:
post/get/put
this.axios.post('url', {firstName: this.Fred, lastName: this.Flintstone,}).then(function (response) {
console.log(response);
}).catch(function (error) {
console.log(error);
});
参数后加token
{imagedata: vm.urls, token: token}
post form
login () {
console.log(1)
let vm = this
this.$http.post('http://39.106.96.131:9392/login?userno=' + vm.user + '&password=' + vm.password).then(res => {
console.log(res)
}).catch(err => {
console.log(err)
})
}
post formdata 提交
this.$http.post(this.base + '/login', 'userno=' + vm.user + '&password=' + vm.password, {headers: {
'Content-Type': 'application/x-www-form-urlencoded'}}).then(res => {
console.log(res)
}).catch(err => {
console.log(err)
})
}

浙公网安备 33010602011771号