company.jsx文件
import request from '../utils/request';//http地址
function getCompanyList() {
return request({
method: 'GET',
url: '/company/getCompanyList'
});
}
export default getCompanyList;
api 文件
import getProductList from './products';
import getCompanyList from './company';
export default {
getProductList,
getCompanyList
};
引用api文件
api.getCompanyList.then((res) => {
console.log(res);
});
报错:
TypeError: _api_index__WEBPACK_IMPORTED_MODULE_9__.default.getCompanyList.then is not a function
getCompanyList
是方法,调用不正确api.getCompanyList()