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 }) },