Nov*_*ovo 0 javascript typescript ionic-framework
当我尝试执行以下代码时出现此错误,我使用的是 Ionic3 框架:
ERROR TypeError {stack: "TypeError: Object [object Array] has no method 'in... ( http://192.168.0.25:8100/build/main.js:4116:76 )", 消息: "Object [object Array]没有方法 'includes'"}
// console.log(this.events) => [7704]
// console.log(event.id_calenda) => 7653
if (this.events.includes(event.id_calendar)) {
Run Code Online (Sandbox Code Playgroud)
它发生在我装有 Android 4.4.4 的设备上,而另一台装有 Android 7 的设备运行良好,为什么?
我使用Array.prototype.indexOf()而不是修复它Array.prototype.includes():
if (this.events.indexOf(event.id_calender) >= 0) {
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2644 次 |
| 最近记录: |