api
account.js
export default {
checkLogin(data) {
return request.post("/user/login",data)
},
}
index.js
/* 引入并暴露 */
export { default as account } from "./account"
main.js
import * as API from '@/api'
Vue.prototype.$API = API
组件
let result = await this.$API.account.checkLogin(this.loginForm);
console.log(result);