RazorScriptManager 中的错误 - Nuget Gallery 0.6.1
我正在使用 RazorScriptManager - 0.6.1 来缩小我的 asp 的 js 和 css 文件.net mvc 3 应用程序。
当我使用 AddJavaScript
方法时:
@Script.AddJavaScript(localPath: "~/Scripts/jquery-1.6.min.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/modernizr-1.7.min.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/jquery.validate.min.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/jquery.unobtrusive-ajax.min.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/jquery.validate.unobtrusive.min.js", siteWide: true)
@Script.OutputJavaScript()
它显示 jquery-1.6.min.js
引用之后的任何脚本引用的 js 错误。以下是错误的屏幕截图:
请大家给点建议..
I am using RazorScriptManager - 0.6.1 to minify my js and css files for my asp.net mvc 3 application.
When i use AddJavaScript
method as:
@Script.AddJavaScript(localPath: "~/Scripts/jquery-1.6.min.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/modernizr-1.7.min.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/jquery.validate.min.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/jquery.unobtrusive-ajax.min.js", siteWide: true)
@Script.AddJavaScript(localPath: "~/Scripts/jquery.validate.unobtrusive.min.js", siteWide: true)
@Script.OutputJavaScript()
It shows js error for any script reference that comes after jquery-1.6.min.js
reference. Below is the screenshot of the error:
Please advice on this..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来这可能是与 JavaScript 相关的问题,而不是脚本管理器的问题。
错误本身似乎出现在 jquery.validate.min.js 中,它是在引用 Modernizr-1.7.min.js 之后加载的。我创建了一个空的示例项目,引用与您相同的 JavaScript 文件(除了 1.6.1 而不是 1.6),并且我确实遇到了脚本版本之间的冲突。我更新了示例项目以使用最新版本,并且没有错误:
尝试更新项目中的所有 JavaScript NuGet 包,看看是否可以解决您的问题。如果没有,请在 GitHub 上的项目中提出问题,我会查看一下。
It appears this might be a JavaScript-related issue, not a problem with the script manager.
The error itself appears to be in jquery.validate.min.js, which is being loaded after the reference to modernizr-1.7.min.js. I created an empty sample project referencing the same JavaScript files as you did (except with 1.6.1 instead of 1.6), and I did run into a conflict between script versions. I updated my sample project to use the latest versions, and I have no errors:
Try updating all the JavaScript NuGet packages in your project and see if that solves your problem. If it doesn't, open an issue in the project on GitHub and I'll take a look at it.