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);
posted on 2022-01-30 05:46  文种玉  阅读(83)  评论(0编辑  收藏  举报