一:请求接口时解构赋值
async function getAcBehaveList() {
let {
data: { rows: res },
} = await acBehaveList();
let Is = myList(res)
actionBar.actionArr = Is;
console.log('bobobo', Is, actionBar.actionArr);
}
getAcBehaveList();``
二:retful风格
//定义接口
export function unitDetail(code) {
return request({
url: '/zhsq/group/findState/' + code,
method: 'get'
})
}
//接口请求
const code = computed(() => {
return route.query?.groupCode
})
const gettableData = async () => {
const res = await listGroup()
tableData.value = res.rows
console.log('ressss', code)
}
const getUnitDetail = async (code) => {
const res = await unitDetail(code);
console.log("getUnitDetail", res);
}
getUnitDetail(code.value)
接口请求相关
于 2023-02-20 14:27:12 首次发布