小编Ale*_*lex的帖子

猫头鹰旋转木马 - 类型错误:无法读取未定义的属性“fn”

我尝试在我的反应应用程序中使用 owl.carousel 包。我使用 npm 安装了 jquery 和 owl.carousel 包。

npm install jquery owl.carousel
Run Code Online (Sandbox Code Playgroud)

在 App.js 中

import React from 'react';
import $ from 'jquery';
import 'owl.carousel';


componentDidMount() {
$('.team-slides').owlCarousel({
// my options
});
}
Run Code Online (Sandbox Code Playgroud)

我收到错误消息

TypeError: Cannot read property 'fn' of undefined.
/owl.carousel/dist/owl.carousel.js:1718

  1715 |  * @todo Navigation plugin `next` and `prev`
  1716 |  * @public
  1717 |  */
> 1718 | $.fn.owlCarousel = function(option) {
       | ^  1719 |  var args = Array.prototype.slice.call(arguments, 1);
  1720 | 
  1721 |    return …
Run Code Online (Sandbox Code Playgroud)

jquery reactjs owl-carousel create-react-app

5
推荐指数
2
解决办法
2万
查看次数

标签 统计

create-react-app ×1

jquery ×1

owl-carousel ×1

reactjs ×1