json、data、 form、form-data、header传值
form ——params
this.$http.get(this.$api + 'url', {
params:{
pageNumber: this.currentPage,
pageSize: 10,
searchText: ''
}
})
.then((res) => {
}).catch((e) => {
console.log(e)
})
form-data
let formData = new FormData()
formData.append('pageNumber',1)
formData.append('pageSize',10)
formData.append('departmentId',id)
this.$http.post(this.$api + 'url', formData)
.then((res) => {
}).catch((e) => {
console.log(e)
})
json
this.$http.post(url , {
subSystemAppId:this.appId,
roleName:this.form.roleName,
roleCode:this.form.roleCode,
description:this.form.description,
editable: this.editable
})
.then((res) => {
}).catch((e) => {
console.log(e)
})
header
方法一
this.$http.get(this.$api + `url`,{
params:{
id:row.id
}
})
.then((res) => {
}).catch((e) => {
console.log(e)
})
方法二
bannerClick (val) {
this.$api.portal.get(`url/${val.bannerId}`).then((r) => {
const d = r.data
if (d.code === 0) {
if (d.data.bannerUrl) {
window.open(d.data.bannerUrl, '_blank')
}
}
})
}