TypeError:this.$ el.DataTable不是一个函数(REACT.JS) [英] TypeError: this.$el.DataTable is not a function( REACT.JS)

查看:96
本文介绍了TypeError:this.$ el.DataTable不是一个函数(REACT.JS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:

您好,我是新手,现在正在构建具有 datatables 的应用程序.

Hello, i am newbie to react and currently building an application which has datatables .

问题:

它完美地在本地计算机(pc)上运行,但是当我在codeandbox中使用相同的代码时,我得到TypeError:this.$ el.DataTable不是一个函数. 我尝试使用数据表& jQuery cdns位于index.html文件中,但没有任何作用. 任何提示,建议都将有所帮助, 预先感谢.

It runs on the local machine(pc) perfectly but when i use the same code in codesandbox then i get TypeError: this.$el.DataTable is not a function. I have tried using datatable & jquery cdns inside the index.html file but it doesn't have any effect. Any hint ,suggestion would be helpful, thanks in advance.

代码:

https://codesandbox.io/embed/jjwx6n2r93

推荐答案

您的代码中有两个问题.我在叉子上评论了他们.

There were two issues in your code. I have commented them in the fork.

https://codesandbox.io/s/8n1my7rxrj?fontsize=14

这篇关于TypeError:this.$ el.DataTable不是一个函数(REACT.JS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆