如何在每次页脚加载(或页面加载?)时触发

这里有一些相关信息。

Javascripts targeting the footer doesn't work after page transitions - #4 by Johani

当你使用以下代码时:

api.onAppEvent("inserted-custom-html", () => {
  // 一些代码
});

你需要指定要 targeting 的自定义 HTML 内容,不同的事件会据此触发。

在这种情况下,你需要 targeting 页脚。你可以试试这个,看看是否对你有效吗?

api.onAppEvent("inserted-custom-html:footer", () => {
  // 一些代码
});