AccountsTemplates在FlowRouter / BlazeLayout

时间:2017-08-09 11:04:16

标签: meteor meteor-blaze user-accounts flow-router

我正在使用 useraccounts:flow-routing useraccounts:materialize & kadira:闪耀布局。 FlowRouter将导航到声明的表单页面,但仍然显示'/'路由。

我在routes.js中声明了AccountsTemplates配置,并尝试单独声明它无济于事。

我应该如何以不同的方式构建 useraccounts:flow-routing 使用Flow Router显示帐户模板?

进口/启动/客户端/ routes.js

import { FlowRouter } from 'meteor/kadira:flow-router';
import { BlazeLayout } from 'meteor/kadira:blaze-layout';
import { AccountsTemplates } from 'meteor/useraccounts:core';


// Import needed templates
import '../../ui/layouts/body/body.js';
import '../../ui/pages/home/home.js';
import '../../ui/pages/not-found/not-found.js';
import '../../ui/pages/login/login_page.js';

// Account Templates
AccountsTemplates.configure({
    defaultLayout: 'App_body',
    defaultLayoutRegions: {},
    defaultContentRegion: 'main',
    enablePasswordChange: true,
    showForgotPasswordLink: true,
    sendVerificationEmail: true,
    confirmPassword: false,
});

AccountsTemplates.configureRoute('changePwd');
AccountsTemplates.configureRoute('forgotPwd');
AccountsTemplates.configureRoute('resetPwd');
AccountsTemplates.configureRoute('signIn', {
    path: '/login',
});
AccountsTemplates.configureRoute('signUp');
AccountsTemplates.configureRoute('verifyEmail');

// Set up all routes in the app
FlowRouter.route('/', {
    name: 'App.home',
    action () {
        BlazeLayout.render('App_body', { main: 'App_home' });
    },
});

FlowRouter.notFound = {
    action () {
        BlazeLayout.render('App_body', { main: 'App_notFound' });
    },
};

/imports/ui/layouts/body/body.html

<template name="App_body">
    <div class="wrapper">
        <nav>
            <div class="nav-wrapper">
              <a href="{{pathFor '/'}}" class="brand-logo">Pair of Losers</a>
              <a href="#" data-activates="mobile-demo" class="button-collapse"><i class="material-icons">menu</i></a>
              <ul class="right hide-on-med-and-down">
                <li><a href="sass.html">Sass</a></li>
                <li><a href="badges.html">Components</a></li>
                <li><a href="collapsible.html">Javascript</a></li>
                <li><a href="mobile.html">Mobile</a></li>
            </ul>
            <ul class="side-nav" id="mobile-demo">
                <li><a href="{{pathFor '/login'}}">Login</a></li>
                <li><a href="{{pathFor '/sign-up'}}">Sign Up</a></li>
            </ul>
        </div>
    </nav>

    <div class="container">
        <div class="row">
            <div class="col-xs-12"> 
              {{> Template.dynamic template=main}}
          </div>
      </div>
  </div>
</div>
</template>

0 个答案:

没有答案