做有的项目使用这个特性后导致有些能用,有些不能用的问题。
具体表现:大部分手机显示正常,到一些老手机显示不正常。比如meizu5s,oppoR9m。
解决方案:
自己写个js,在项目前import一下。
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 =
}
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];
}
}
}
}
target[key] = source[key];
}
}
}
}
return target;
};
}
};
}
参考方案:
https://github.com/zloirock/core-js#commonjs
https://blog.csdn.net/qq_32786873/article/details/72847190