html52.com
我爱小程序-开发者交流社区

o.functionName is not a function

问题模块 框架类型 问题类型 操作系统 操作系统版本 手机型号 微信版本
客户端 小程序 Bug Android Android 8 华为P10 6.6.7

let data = [];

....

this.findById = function(id) {

    return data.find((d, index, arr) => {

        return d.id == id;

    });

};


data在api请求中更新。有时候会报thirdScriptError,o.find is not a function. 'o.find'  is undefined.


报这个错误时,通常是在网络请求更新data数据时。


但是。。。即便是在更新数据,原有的data数据还是在的,怎么会报这个错误呢?


求大神指点!!


网友回复

楠A.H:

数据请求是异步的,但是在请求完最后把新的数据赋值到data之前,data里是有原来数据的,怎么会报这样的错误呢,o.find is not a function. 'o.find'  is undefined

data是数组,find函数应该是一只有的。

Try to do:

因为数据请求是异步的  然后这个方法已经执行了吧

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付