Meteor 中多步骤注册流程的设计模式

Design pattern for a multiple step signup flow in Meteor

我正在尝试构建一个 3 步注册流程,即分布在 3 个 screens/templates 中,但使用相同的路线。我正在使用 Blaze & FlowRouter 顺便说一句。

实现此目的的简单模式是什么?

感谢任何能引导我走向正确方向的想法,谢谢!

我已经使用 dynamic templates and a reactive var 完成了这个模式。

帮助您入门的小示例代码

signup.html

<template name="signupContainer">
    {{> Template.dynamic template=template}}
</template>

<template name="signupStepOne">
    <h1>Step One</h1>
    <button id="next-step-btn">Next Step</button>
</template>

<template name="signupStepTwo">
    <h1>Step Two</h1>
</template>

signup.js

Template.signupContainer.onCreated(function () {
    var instance = this;
    instance.activeTemplate = new ReactiveVar('signupStepOne');
});

Template.signupContainer.events({
    'click #next-step-btn': function (event, instance) {
        instance.activeTemplate.set('signupStepTwo');
    }
});

Template.signupContainer.helpers({
    template: function () {
        var instance = Template.instance();
        return instance.activeTemplate.get();
    }
});