简体   繁体   English

wicket 1.5中的javascript引用顺序

[英]javascript references order in wicket 1.5

i have a problem with the javascript references in my page since migrating to wicket 1.5. 由于迁移到检票口1.5,我的页面中的javascript引用出现了问题。 i'm contributing few js files to the header from a wicket page, and then useing them in the page's components. 我正在从检票页面的页眉中贡献一些js文件,然后在页面的组件中使用它们。

the problem is that if i use wicket 1.5 way to contribute js - adding a behavior which contributes the js in its renderHead method, the renderHead of the components that are using the js is called before the renderHead of the page or of the page's added behaviors, which of course leads to Uncaught ReferenceError. 问题是,如果我使用wicket 1.5方式贡献js-在其renderHead方法中添加有助于js的行为,则使用js的组件的renderHead在页面或页面的renderHead的renderHead之前被调用,这当然会导致Uncaught ReferenceError。

any idea how to control the order of the js? 任何想法如何控制js的顺序? thank you in advance 先感谢您

update: 更新:

after intensive search i found that what i'm willing to do is practically impossible in wicket 1.5. 经过深入的搜索后,我发现我愿意做的实际上在1.5号小门上是不可能的。 as explained here wicket guys have decided to reverse the order the js and css is rendered - deepest components first and then container (instead the other way around - which was the behavior until 1.5). 正如这里所解释的检票员决定改变js和css的呈现顺序-首先是最深的组件,然后是容器(反之则相反-直到1.5为止都是如此)。 the rendering strategy is not configurable by any mean. 渲染策略绝不是可配置的。

i wouldn't expect them to do such a change, especially without letting the option to override this configuration. 我不希望他们进行这样的更改,尤其是在不让该选项覆盖此配置的情况下。 in my case, for example, i have tens of components that are using jquery, that up until now was added from the page. 以我为例,例如,我有数十个正在使用jquery的组件,到目前为止,该组件是从页面添加的。 now it seems that i'll have to change all my existing components to contribute jquery (and any other required js). 现在看来,我将不得不更改所有现有组件以贡献jquery(以及任何其他所需的js)。 quite harsh, and definitely not backward compatible. 相当苛刻,绝对不向后兼容。

According to Wicket documentation : 根据Wicket文档

[quote] [引用]

  • In the head tag, you would provide your implementation in renderHead 在head标签中,您将在renderHead中提供实现
  • Just after our component render, you would override onRendered or rendered as in the code example above 在我们的组件渲染之后,您将像上面的代码示例中那样覆盖onRendered或渲染
  • Just before our component render, you would override onComponentTag 就在我们的组件渲染之前,您将覆盖onComponentTag

[/quote] [/引用]

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

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