之前的详情接口请求类型都是body,这次遇到了请求类型为query
接口文档:
接口代码
// 维护信息弹窗详情
export function InvoiceDetail(id) {
return request({
url: `/personalCenter/invoice/detail?id=${id}`,
method: 'POST',
})
}
组件代码
<el-button type="text" size="small" @click="handledit(row.row.id)">编辑</el-button>
/* 点击打开弹窗 */
handledit(id) {
this.addInvoiceDialogVisible = true;
this.getdata(id);
},
// 获取单个详情
async getdata(id) {
const result = await InvoiceDetail(id);
console.log(result);
if (result.code === 200) {
const data = result.data;
this.addInvoiceForm = result.data;
}
},
以往请求类型body调取详情接口
// 获取单个渠道详情
export function getChannel(data) {
return request({
url: '/liveCodeManage/channelManage/get',
method: 'POST',
data
})
}
<el-button type="text" size="mini" @click="handleEdit(scope.row.id)">详情</el-button>
handleEdit(id) {
this.edialogVisible = true
this.getdata(id)
},
// 获取单个详情(getChannel为接口地址)
async getdata(id) {
const result = await getChannel({ id: id })
console.log(result)
if (result.code === 200) {
this.addInvoiceForm = result.data;
}
},