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'
    })
  }
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-12
  • 2022-12-23
  • 2021-07-05
  • 2022-12-23
猜你喜欢
  • 2021-04-12
  • 2022-02-17
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
  • 2021-10-18
  • 2021-09-13
相关资源
相似解决方案