Sfoglia il codice sorgente

重写assign方法

Luolei 6 anni fa
parent
commit
9e687931b6
1 ha cambiato i file con 22 aggiunte e 1 eliminazioni
  1. 22 1
      src/js/promise.js

+ 22 - 1
src/js/promise.js

@@ -1,7 +1,28 @@
 const qs = require('qs');
 const $ = require("jquery");
 var Promise = require('./rePromise');
-
+//重写assign方法
+if (typeof Object.assign != 'function') {
+  Object.assign = function(target) {
+    'use strict';
+    if (target == null) {
+      throw new TypeError('Cannot convert undefined or null to object');
+    }
+ 
+    target = Object(target);
+    for (var index = 1; index < arguments.length; index++) {
+      var source = arguments[index];
+      if (source != null) {
+        for (var key in source) {
+          if (Object.prototype.hasOwnProperty.call(source, key)) {
+            target[key] = source[key];
+          }
+        }
+      }
+    }
+    return target;
+  };
+}
 const config = {
   pushInner:'/api/data/push/push',
   calculate:'/api/data/calc/calculate',