Skip to content

生成api文件夹之后怎么使用 #3

@muchen404

Description

@muchen404

image
已经在项目的根目录生成api文件加了,但是不知道怎么使用,我的是vue项目

Activity

whirly77cai

whirly77cai commented on Jan 25, 2018

@whirly77cai

me too. found nothing on the document.

chuangker

chuangker commented on Jan 26, 2018

@chuangker
Contributor

直接 import 这个 api 就行了呀。

ghostchan

ghostchan commented on May 7, 2018

@ghostchan

同不会用,能不能提供个小demo,谢谢

breederComrade

breederComrade commented on Dec 11, 2018

@breederComrade

image
在你需要调用的地方导入接口,我项目叫sass_admin,具体你可以看api/index 文件导出的
import { sass_admin } from '../../api/index';
在你需要调用的地方调用/api/sass_admin/index 内的方法
方法对应的是你在easymack上新建的方法
因为他是创建了一个axios实例对象 所以你可以通过下面方法传参
sass_admin.test_get({ params: { fuck: 1 } });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @chuangker@ghostchan@whirly77cai@muchen404@breederComrade

        Issue actions

          生成api文件夹之后怎么使用 · Issue #3 · easy-mock/easy-mock-cli