api.js文件
const http = uni.$u.http;
// post请求,获取菜单
export const mergedbAll = (params, config = {}) => http.post('/mergedbAll', params, config)
port.js两种方法使用:
import {mergedbAll} from '@/config/api.js';
方法一:
export function port_All1(identifyID) {
// console.log(identifyID);
return new Promise((resolve, reject) => {
const options = {
"identifyID": identifyID
}
mergedbAll(options).then(res => {
const mergedbAll = res.data.mergedbAll;
resolve(res.data.mergedbAll);
})
});
}
方法二:
// 第一个是你抛出去的方法名,第二个是接口API封装的名字
export const port_All1 = async (identifyID) => {
const options = {
"identifyID": identifyID
}
const res = await mergedbAll(options);
return res.data.mergedbAll;
}
项目目录