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