@hzab/data-model 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # @hzab/data-model@1.4.1
2
+
3
+ - fix: handleMsg useStatusText 问题修复
4
+
1
5
  # @hzab/data-model@1.4.0
2
6
 
3
7
  - 兼容分页列表是 content 及相关数据同层的问题 data: { content: [], pageNumber: 1, pageSize: 10, total: 0 }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hzab/data-model",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "data model",
5
5
  "main": "src",
6
6
  "scripts": {
package/src/data-model.js CHANGED
@@ -405,17 +405,21 @@ class DataModel {
405
405
 
406
406
  handleMsg(
407
407
  response,
408
- {
408
+ opt = {
409
409
  // 是否使用 response.statusText 作为兜底 msg
410
- useStatusText,
410
+ useStatusText: false,
411
411
  },
412
412
  ) {
413
+ const {
414
+ // 是否使用 response.statusText 作为兜底 msg
415
+ useStatusText,
416
+ } = opt || {};
413
417
  let message =
414
418
  (response.data && (response.data.message || response.data.msg)) ||
415
419
  response.msg ||
416
420
  this.getNetworkErrMsg(response);
417
421
 
418
- if (useStatusText) {
422
+ if (!message && useStatusText) {
419
423
  message = response.statusText;
420
424
  }
421
425