我有一个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的一个特性吗?也许,导入还有一些额外的参数,我可以使用它们来避免这个问题?提前谢谢。
发布于 2019-04-05 06:10:07
Dojo库使用的是AMD loader,这与XPages中的jquery.suggestions.js冲突。有关类似问题,请参阅this answer。
https://stackoverflow.com/questions/55529140
复制相似问题