我正在开发一个liferay 7主题,并且我在我的主菜单上绑定(bind)了一些JS。 我所有的 js 都在 document.rdy 事件中。 但我看到的是,当我更改页面时,不会触发 document.ready(),并且菜单上的所有 js 绑定(bind)都会丢失。
我该怎么办?
最佳答案
不要使用$(document).ready()
,而是使用AUI().ready()
。
Liferay 7 使用 SennaJS (SPA),因此在加载页面时不会触发 $(document).ready()
(窗口重新加载时除外)。
参见: https://portal.liferay.dev/docs/7-0/tutorials/-/knowledge_base/t/automatic-single-page-applications
关于javascript - Liferay 7 主题 : docment. 更改页面时未触发ready(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43255999/