流星不跟随链接/铁路由器不重新渲染

时间:2015-11-05 17:52:45

标签: meteor iron-router

我遇到这种奇怪的行为有困难。我有一个简单的链接:

<a href="/page2/param">Link</a>

如果我点击该链接然后返回上一页,则相同的链接将不再起作用。谷歌浏览器似乎是由铁路由器重新渲染模板引起的,但我找不到解决这个问题的方法。

任何提示?

这是我的router.js

Router.configure({
    layoutTemplate: "layout"
});
Router.route("/page1/:id", {
    name: "page1",
    template: "page1",
    yieldTemplates: {
        info: {
            to: "info"
        }
    },
    waitOn: function() {
        return Meteor.subscribe("publish", {
            _id: this.params.id
        });
    }
});
Router.route("/page2/:id", {
    name: "page2",
    template: "page2",
    waitOn: function() {
        return Meteor.subscribe("publish", {
            _id: this.params.id
        });
    }
});

这是我的模板

<template name="layout">
    {{#if currentUser}}
        {{>yield region="info"}}
    {{/if}}
    {{> yield}}
</template>

<template name="info">
    <a href="/page2/{{id}}">
        <button type="submit">Submit</button>
    </a>
</template>

0 个答案:

没有答案
相关问题