使用jquery导入某些库会冻结整个xpage

问题描述 投票:0回答:1

我有一个XPage只使用2个js导入 - 其中一个是JQuery,另一个依赖于JQuery,它用于俄罗斯联邦的智能公司搜索。我遇到的问题是,当我尝试导入第二个库时,整个页面都没有响应(例如无法单击任何按钮)。

这就是我的意思:

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">

    <xp:this.resources>
        <xp:script
            src="https://code.jquery.com/jquery-3.3.1.js"
            clientSide="true">
        </xp:script>

    <!-- the problematic library -->    
    <xp:script src="https://cdn.jsdelivr.net/npm/suggestions-jquery/dist/js/jquery.suggestions.js"
            clientSide="true">
        </xp:script>

        <xp:styleSheet
            href="https://cdn.jsdelivr.net/npm/suggestions-jquery/dist/css/suggestions.min.css">
        </xp:styleSheet>

    </xp:this.resources>
<xp:div>

</xp:div>

<xp:button id="Unresponsive button">
    Here's the unresponsive button
    <xp:eventHandler event="onclick" submit="false">
        <xp:this.script><![CDATA[alert('we'll never be able to see this')]]></xp:this.script>
    </xp:eventHandler></xp:button>

</xp:view>

因此,当我导入第二个库时,页面变得无响应(CSJS和SSJS都不执行)。我不知道为什么会这样。当我编写相同的代码,但只是一个简单的HTML页面,我没有遇到问题。它只是一个XPage功能吗? Perphaps,有一些额外的导入参数,我可以用它来避免这个问题?提前致谢。

javascript jquery xpages
1个回答
2
投票

jquery.suggestions.js库使用AMD加载程序,它与XPage中的Dojo冲突。请参阅this answer类似的问题。

© www.soinside.com 2019 - 2024. All rights reserved.