if (!Array.prototype.flat) { Object.defineProperty(Array.prototype, 'flat', { configurable: true, value: function flat(): any[] { const depth: number = isNaN(arguments[0]) ? 1 : Number(arguments[0]); return depth ? Array.prototype.reduce.call(this, function (acc: any[], cur: any[]): any[] { if (Array.isArray(cur)) { acc.push.apply(acc, flat.call(cur, depth - 1)); } else { acc.push(cur); } return acc; }, []) : Array.prototype.slice.call(this); }, writable: true }); } // 部分ios机型没有这个方法 if (!Date.now) { Date.now = () => (new Date()).getTime(); }