使用 Flow Router 如何在访问页面时重新执行功能?

With Flow Router how to re-execute a function upon visitng the page?

我在模板的 onRendered 挂钩中设置了一些函数,如下所示:

Template.PanelLayout.onRendered(function() {
    Tracker.autorun(function() {
        if (ready.get()) {
            page = Pages.findOne({
                slug: 'about'
            });
            tinymce.init({
                selector: "#pageContent",
                height: 400
            });
            tinymce.get('pageContent').setContent(page.content);
        }
    });
});

如果我直接访问该页面或重新加载该页面,这些功能将起作用。但是,如果我仅通过单击导航中的 link 来访问它,则不会加载这些功能。我该如何解决这个问题?

简短的回答是你不能,因为这就是 FlowRouter 的工作方式: FlowRouter docs

For a single interaction, the router only runs once. That means, after you've visit a route, first it will call triggers, then subscriptions and finally action. After that happens, none of those methods will be called again for that route visit.

你做的好像更适合Meteor's Template helper