【问题标题】:jquery.mobile 1.4.5 Uncaught TypeError: Cannot read property 'concat' of undefinedjquery.mobile 1.4.5 Uncaught TypeError:无法读取未定义的属性“concat”
【发布时间】:2016-11-24 15:21:18
【问题描述】:

我创建了一个示例 index.html 文件并包含最新的 jquery (3.1.0) 和 jquery mobile (1.4.5)。

在加载页面错误控制台输出:

jquery.mobile-1.4.5.js:3337 Uncaught TypeError: Cannot read property 'concat' of undefined`

在这一行:

mouseEventProps = $.event.props.concat( mouseHookProps ),

当我尝试包含 jquery-1.11.2 时没有问题。谁能告诉我为什么?

【问题讨论】:

  • 检查jquery3是否与jquery.mobile1.4.5兼容

标签: javascript jquery jquery-mobile


【解决方案1】:

Look this Documentation

jQuery mobile 被某些版本的 jQuery 锁定!你会发现一个文本

jQuery Mobile 1.3.0 支持 jQuery core 1.7.2 – 1.9.1 和 我们也在积极测试即将推出的 2.0 版本。我们将 与他们的版本保持同步,让您充分利用 新的善良。

更新

jQuery mobile 现在也适用于 2.x 版本,但版本 3 仍然返回上述错误。

【讨论】:

  • 使用jQuery Migrate plugin 很好地解决了这个问题。
  • 你是如何做到这一点的?
  • @dsghi 我在我的网站上加载了 jquery-migrate-1.4.1.min.js,但它并没有解决问题。错误仍然存​​在。我确保在 jquery-mobile JS 文件上方加载 jquery-migrate 文件。
  • 我很抱歉,我不记得我采取了哪些步骤 - 吸取的教训,我以后不会发布没有使用的 cmets。 ://
  • 2.1.1 为我工作,谢谢 :) 只是不知道为什么他们会将 jquery 3 和 jquery-mobile 1.4.5 放在同一个下载页面上,我的脑海中自动想到“是的,他们一定是相关”
【解决方案2】:

使用最新版本 1.5 (可在: code.jquery.com):

http://code.jquery.com/mobile/1.5.0-rc1/jquery.mobile-1.5.0-rc1.min.js

【讨论】:

  • 这个答案对我有用。我使用 1.5.0-alpha 而不是 1.4.5
  • Coloquei esta versão 1.5 e resolveu meu problema。我把这个版本 1.5 并解决了我的问题。
  • 翻录 jQuery mobile 2019,请竖起大拇指!!
  • 1.5 现已退出 Alpha 版,现在是候选版本 1:code.jquery.com/mobile/1.5.0-rc1/jquery.mobile-1.5.0-rc1.min.js
  • 谢谢!这消除了这个特殊问题。但随后遇到了下一个:Can not read property 'defaults' of undefined.. on this code.. $.mobile.changePage.defaults 有什么建议吗?
【解决方案3】:

它相对于主要的 jquery cdn 版本。 js文件和css必须是同一版本

你可以使用这些来获取:

【讨论】:

  • 这个答案有没有漏掉的部分?
猜你喜欢
  • 2017-07-20
  • 2016-08-06
  • 2023-04-08
  • 2021-04-28
  • 1970-01-01
  • 2020-03-28
  • 2023-04-11
  • 2016-04-22
相关资源
最近更新 更多