Rerender on new route or transition

当 Discourse 渲染“页脚”时,应用会发送一个“事件”。

该事件为 inserted-custom-html:footer

您可以使用此事件来更新页脚内容,方法如下:

api.onAppEvent("inserted-custom-html:footer", () => {
  // 在此处添加您的 JS 代码
});

这里还有一些更多细节 在此处。

这应该能实现您想要的效果。如果不行,请告诉我,并附上您正在使用的代码。