gpt4 book ai didi

jquery - Owl Carousel - 类型错误 : Cannot read property 'fn' of undefined

转载 作者:行者123 更新时间:2023-12-04 02:39:14 26 4
gpt4 key购买 nike

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

npm install jquery owl.carousel

在 App.js 中
import React from 'react';
import $ from 'jquery';
import 'owl.carousel';


componentDidMount() {
$('.team-slides').owlCarousel({
// my options
});
}

我收到错误信息
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 this.each(function() {

请帮我解决这个问题。

最佳答案

您必须将这些包含在您的 index.html

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"></script>


<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>

关于jquery - Owl Carousel - 类型错误 : Cannot read property 'fn' of undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60134279/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com