Code Monkey home page Code Monkey logo

apijson-builder's Introduction

apijson-builder

apijson 不必过多解释,可查看连接。 apijson的请求构建是唯一的学习成本(不考虑撸源码的话),因此为了方便js构建rest请求, 所以有了apijson-builder, 是个小东西,代码量也很小。方便你快速构建apijson的rest请求。

安装

import ApiJsonBuilder from 'apijson-builder'
Vue.use(ApiJsonBuilder, {
    baseURL: '/api/apijson',
    tokenKey: 'X-Token',
    token: '304958029525nsd23423'
})

使用

import {QueryBuilder} from 'apijson-builder';
import Condition from "./condition";
QueryBuilder.by('User')
        .condition(Condition.by('name', 'like', 'zhang'))
        .order('name')
        .multi(true)
        .setResFields('name,age,phone')
        .page(0, 10)
        .send()
.then(resp => {
    const {total, User: users} = resp // users 即为数据, total为总数
})

关于token

你可以这样设置token

import {setToken, LoginBuilder} from "apijson-builder";

LoginBuilder.login('username', 'password').then(resp => {
    const {token} = resp
    setToken(token)
})

其他

更多使用方式自己看下就知道了, 欢迎来完善。 来改源码前请务必熟知apijson的语法!

apijson-builder's People

Contributors

pengxianggui avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.