zoukankan      html  css  js  c++  java
  • 对象解构传参

    http-p.js

    // 对象解构的方式传参
      request({url, data={}, method='GET'}) {
        return new Promise((resolve, reject)=>{
          // 正常调用参数 url, data, method
          this._request(url, resolve, reject, data={}, method='GET')
        })

    book.js

    import {
      HTTP
    } from '../util/http-p.js'
    
    class BookModel extends HTTP {
      getHotList() {
        return this.request({    // 用对象的方式传参
          url: 'book/hot_list'
        })
      }
    }
  • 相关阅读:
    iView
    JS
    JS
    JS
    Java
    Java
    Java
    Java
    Java
    Java
  • 原文地址:https://www.cnblogs.com/qq254980080/p/10650937.html
Copyright © 2011-2022 走看看