gpt4 book ai didi

javascript - jQuery url.indexOf 不是函数

转载 作者:搜寻专家 更新时间:2023-11-01 05:09:23 26 4
gpt4 key购买 nike

我刚刚安装了 jQuery 使用

npm install jquery

在使用 Webpack 将 jquery、bootstrap 合并到 vendor 文件后,我不断收到以下错误

vendor.4b59d15129c2efa4408c.js:9979 Uncaught TypeError: url.indexOf is not a function
at jQuery.fn.init.jQuery.fn.load (vendor.4b59d15129c2efa4408c.js:9979)
at Object.<anonymous> (bundle.7beebbf8c43d73f31563.js:55)
at Object.<anonymous> (bundle.7beebbf8c43d73f31563.js:213)
at __webpack_require__ (vendor.4b59d15129c2efa4408c.js:55)
at Object.<anonymous> (bundle.7beebbf8c43d73f31563.js:12)
at __webpack_require__ (vendor.4b59d15129c2efa4408c.js:55)
at webpackJsonpCallback (vendor.4b59d15129c2efa4408c.js:26)
at bundle.7beebbf8c43d73f31563.js:1

最佳答案

您的 jQuery 版本是多少?在版本 3 中,函数 $(window).load() 已被弃用。使用 .load().unload().error() 时会抛出错误。

将这些函数替换为:

$(window).load( function () {} )

版本 3 以上

$(window).on('加载', function () {} )

$(window).on('错误', function () {} )

我自己的案例是使用带有 Vue.js 的 SuperSimpleSlider jQuery 插件。我必须用正确的解决方案替换原始文件(插件)。

希望这对您有所帮助!

来源: jqueryhouse.com

关于javascript - jQuery url.indexOf 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46368365/

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