- 更新所有文件的导入和导出语法,使用 ES6 模块格式 - 修改 package.json,添加 "type": "module" 配置 - 调整部分代码结构以适应 ES6 模块
30 lines
665 B
JavaScript
30 lines
665 B
JavaScript
export class SearchQuery {
|
|
constructor({ size, page, sort, filters }) {
|
|
this.size = size
|
|
this.page = page
|
|
this.sort = sort
|
|
this.filters = filters
|
|
}
|
|
}
|
|
|
|
class SearchResult {
|
|
constructor({ list = [], num = 0, size = 0, total = 0 } = {}) {
|
|
if (typeof num !== 'number') {
|
|
throw new Error('Invalid num parameter')
|
|
}
|
|
if (typeof size !== 'number') {
|
|
throw new Error('Invalid size parameter')
|
|
}
|
|
if (typeof total !== 'number') {
|
|
throw new Error('Invalid total parameter')
|
|
}
|
|
|
|
this.list = list
|
|
this.num = num
|
|
this.size = size
|
|
this.total = total
|
|
}
|
|
}
|
|
|
|
export default { SearchQuery, SearchResult }
|