Meteor iron路由器中的next()对此完全困惑

Totally confused about this.next() in Meteor iron-router

本文关键字:路由器 iron next Meteor      更新时间:2023-09-26

我升级到Meteor 1.0,安装了最新的iron路由器包,尝试运行我的应用程序,并在控制台日志中收到了这个漂亮的警告:

从未呈现路由调度。你忘了在中调用this.next()了吗一个onBeforeAction?

所以我试着根据新版本修改我的路线。

this.route('gamePage', {
        path: '/game/:slug/',
        onBeforeAction: [function() {
            this.subscribe('singlePlayer', this.params.slug).wait();
            var singlePlayer = this.data();
            if (singlePlayer) {
                if (singlePlayer.upgrade) {
                    this.subscribe('upgrades', this.params.slug).wait();
                    this.next();
                }
                this.next();
            }
            this.next();
        }],
        data: function() {
            return Games.findOne({slug: this.params.slug});
        },
        waitOn: function() { return [Meteor.subscribe('singleGame', this.params.slug)]}
    });

我该怎么解决这个问题?如有任何帮助,我们将不胜感激。

尝试删除所有.wait(),并删除onBefore函数周围的数组。

使用新的API,this.next()将取代.wait()