Giter Club home page Giter Club logo

mockserver's Introduction

tp2

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

# build for production and view the bundle analyzer report
npm run build --report

framework & util

Name Version Description
vue-npm Loads and compiles Vue Components
babel-npm Loads ES2015+ code and transpiles to ES5 using Babel
sass-npm Loads and compiles a SASS/SCSS file
webpack-npm a bundler for modules. bundle JavaScript files for usage in a browser
3.0.3 AlipayJSAPI 提供丰富的支付宝原生 API,可以方便调用支付宝提供的能力,达到媲美原生应用的体验。
aliyun

注意事项

  • js、css、html 文件名全部小写,单词用下划线 “_” 连接

hello_world.js

  • vue组件的name属性首字母大写
    export default {
        name:"HelloWorld"
    }
  • scss文件中使用@import时 需要把后缀名写全,并带上注释
    @import "hello_world.scss";//hello_world组件用的样式
  • 所有的接口地址写在apis_map.js文件中,带参数的地址可以用花括号表示
    let map={
        "api":"/hello/world",
        "test":"/api/helloworld/{name}"
    }

apis_map.js中存放所有的接口地址,在组件中使用this.$api访问,访问带未解析参数的地址会报错

  // in apis_map.js
  let map={
      "test":"/api/helloworld/{name}"//这个地址有未解析的参数
  }
  //...
  //in vue component
  this.$api.test //会输出异常 不能直接使用带未解析参数的地址

Api对象提供一个resolve方法用来解析带参数的地址

  // in apis_map.js
  let map={
      "test":"/api/helloworld/{name}"
  }
  //...
  //in vue component
  this.$api.resolve("test","peter") //return "/api/helloworld/peter"
  
  /*
  * @param {String} key api地址的名字
  * @param {String} * 可以传入任意数量的参数 需要和api地址中未解析的参数个数保持一致
  */
  this.$apis.resolve(key,param1,param2,...n)

mockserver's People

Watchers

James Cloos avatar Murphy Han 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.