URLSearchParams和axios的post请求(防忘记)

import axios from 'axios'

Vue.prototype.axios = axios
mounted () {
let params = new URLSearchParams()
params.append('id', this.$route.params.id)
params.append('cid', this.$route.params.cid)
this.loading = true
this.axios.post(this.host + 'Api/Pinyin/detail', params).then(res => {
this.loading = false
if (res.data.status) {
this.all = res.data.info
this.all.map((v, index) => {
if (v.id === this.$route.params.id) {
this.thumb = v.thumb
this.index = index
this.currentMp3 = v.mp3
this.gif = v.gif
}
})
}
}).catch(function (res) {
this.loading = false
})
},

  

上一篇:Android stdio 报错 error invoking main method


下一篇:第十二章:window对象