简体   繁体   English

Visual Studio 2017中的Bootstrap和Javascript冲突问题

[英]Bootstrap and Javascript conflict issue in Visual Studio 2017

I have upgraded my one ASP.NET Core project from VS2015 to VS2017 . 我已经将我的一个ASP.NET Core项目从VS2015VS2017 As a result, the jquery was upgraded from 2.2.3 to 3.2.1 and Bootstrap was upgraded from 3.3.6 to 3.3.7 . 结果,jquery从2.2.3升级到3.2.1Bootstrap3.3.6升级到3.3.7 Now I'm getting the following error: 现在出现以下错误:

Error 错误

Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3 Bootstrap的JavaScript需要jQuery 1.9.1或更高版本,但低于版本3

Snapshot of Error in Google Chrome's Dev Tool : Google Chrome开发人员工具中的错误快照

在此处输入图片说明

On the other hand VS2017 is not allowing me to downgrade Bootstrap from 3.3.6 to a version lower than 3 (also explained here why). 另一方面, VS2017不允许我将Bootstrap从3.3.6降级到低于3的版本( 此处也解释为什么)。

Question : How do I resolve the above issue? 问题 :我该如何解决以上问题? I'm stuck at the home page of the app where the issue occurs. 我被卡在发生问题的应用程序主页上。

As the error message says, the jQuery version is too new for Bootstrap 3.3.x to use. 如错误消息所述,对于Bootstrap 3.3.x而言, jQuery版本太新而无法使用。

You have two options: 您有两种选择:

  1. Downgrade jQuery the latest 2.x version 降级jQuery最新的2.x版本
  2. Upgrade Bootstrap to 4.x (see here ) which requires to run on jQuery 3 将Bootstrap升级到4.x(请参阅此处 ),这需要在jQuery 3上运行
  3. Don't use the bootstrap.js at all and use ngx-bootstrap (only if you are using Angular >= 2, since it replaces the jQuery functions with a better integrated angular 2 directives) 完全不要使用bootstrap.js并使用ngx-bootstrap (仅当您使用Angular> = 2时,因为它用更好的集成angular 2指令替换了jQuery函数)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM