我尝试在我的反应应用程序中使用 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)