使用this.$http.get 和 this.$http.post传参
uniapp使用this.$http.get 和 this.$http.post传参
get:
let tmp = {
xxxx: xxx,
}
// console.log();
this.$http.get(/xxxxxxx/xxxxxxxxxxxxx/list, {
params: tmp
})
.then(res => {
console.log(res.data.result);
if (res.data.success == true) {
//请输入业务逻辑
this.pics1 = res.data.result.records[0].imageUrl.split(,)
} else {
uni.showToast({
icon: none,
title: 您填写的参数有误,请查证后再提交!,
duration: 2000
})
}
}).catch(err => {
uni.showToast({
icon: none,
title: 发起失败,请联系管理员!,
duration: 2000
})
console.log(err);
})
post:
let tmp = {
a:1}
this.$http.post(/sxxxx/xxxxxxxxxx, tmp )
.then(res => {
console.log(res.data.result);
if (res.data.success == true) {
//请输入业务逻辑
} else {
uni.showToast({
icon: none,
title: 您填写的参数有误,请查证后再提交!,
duration: 2000
})
}
}).catch(err => {
uni.showToast({
icon: none,
title: 发起失败,请联系管理员!,
duration: 2000
})
console.log(err);
})
