【问题标题】:Jquery Terminal In MVC Doesnt Work For MeMVC 中的 Jquery 终端对我不起作用
【发布时间】:2016-05-23 07:04:22
【问题描述】:

刚刚在我的 cloud9 项目中实现了http://terminal.jcubic.pl/#demo。它就像一个魅力,做它应该做的一切。

项目 = https://ide.c9.io/wigge/andreas-cv

网站 = andreas-cv-wigge.c9users.io/kol.html

现在解决问题。 我希望它可以在我的视觉工作室的 MVC 项目中工作,但到目前为止,它还没有。

MVC 问题 = http://gyazo.com/c24931d3479e6fe2df756e17af542f24

终端似乎没有得到它应该得到的脚本或其他东西,我可以在终端中写入但不能删除并点击进入。

这是我在 MVC 中的代码(我将在文件中提供 js 代码并稍后链接它们)jsfiddle.net/19o39bx1/#&togetherjs=Ux8Mez1pOv

有人知道它是什么吗?

或者也许有人有更好的终端供我使用

【问题讨论】:

  • 请不要链接 MWE,而是将其添加到问题中

标签: javascript jquery html asp.net-mvc jquery-terminal


【解决方案1】:

asp.ne MVC 项目中,默认情况下jQuery 文件被添加到包含在默认页面中的捆绑广告中。我猜你也添加了jQuery 文件引用。并且在jcubic'sanswer是在加载两个jquery文件时重现的场景。

【讨论】:

    【解决方案2】:

    当我在代码之后包含另一个 jQuery 时,我能够重现该错误,

    <script src="js/jquery-1.8.0.js"></script>
    <script src="js/jquery.mousewheel-min.js"></script>
    <script src="js/jquery.terminal-src.js"></script>
    <script>
    jQuery(function($) {
        $('body').terminal(function(command, term) {
          term.echo(command);
        });
    });
    </script>
    <script src="http://code.jquery.com/jquery-1.12.4.min.js"></script>
    

    检查您是否没有包含另一个 jQuery(可能添加了 MVC,检查结果页面的源代码)。

    这是 jQuery 终端中的一个错误,可以在那里修复。

    【讨论】:

    • 在 0.10.9 版本中修复。
    【解决方案3】:

    JQuery 终端模拟器脚本似乎在加载 jQuery 代码之前启动,为了防止这种情况,请尝试按此顺序执行您的脚本:

    <script src="http://code.jquery.com/jquery-latest.min.js"></script>//download jquery
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/0.10.9/js/jquery.terminal.min.js"></script>//download jquery terminal
    <link href="https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/0.10.9/css/jquery.terminal.min.css" rel="stylesheet"/>// jquery terminal styles
    

    【讨论】:

    • 如果在 JQuery 之前包含终端,则例外是未定义 jQuery。
    猜你喜欢
    • 2021-05-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-06
    相关资源
    最近更新 更多