【问题标题】:Meteor - FlowRouter - Blank pagesMeteor - FlowRouter - 空白页
【发布时间】:2016-07-04 11:04:30
【问题描述】:

大家好,我正在做一个关于扩展用户类的教程, Link教程1 在我尝试的每条路径中,我总是得到一个空白页,我不明白为什么。 任何帮助,将不胜感激。 这是我的 routes.js 文件:

FlowRouter.route('/', {
   name: 'home',
   action: function() {
   BlazeLayout.render("mainLayout", {
      content: "home"
   });
  }
});
FlowRouter.route('/login', {
   name: 'login',
   action: function() {
   BlazeLayout.render("mainLayout", {
      content: "login"
   });
  }
});
FlowRouter.route('/register', {
   name: 'register',
   action: function() {
   BlazeLayout.render("mainLayout", {
      content: "register"
   });
  }
});

这是我的 main-layout.html

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

这是我的仓库的链接:https://bitbucket.org/mmrj9/hubapp/src

【问题讨论】:

    标签: meteor meteor-blaze flow-router


    【解决方案1】:

    是页面上的其他一些问题导致了这些问题。 flow-router 的使用很好。它们可以很好地呈现静态 HTML 节点。

    比如说,你的主页的缩小版,

    <template name="home">
        Home Page.
    </template>
    

    ,按预期在客户端渲染字符串。

    不会在此处列出问题清单,但希望这能对您有所帮助。

    【讨论】:

  • 问题似乎出在这里
  • 【解决方案2】:

    您是否定义了其他模板?

    例如主页模板

    <template name="home">
        {{#with currentUser}}
        <div class="ui raised segment">
            <h1 class="ui header">Current User</h1>
            <p>First Name: {{profile.firstName}}</p>
            <p>Last Name: {{profile.lastName}}</p>
            <p>Profile Picture: <img class="ui small circular image" src="{{profile.profPicture}}" /></p>
            <p>Organization: {{profile.organization}}</p>
        </div>
        {{/with}}
    </template>
    

    【讨论】:

      猜你喜欢
      相关资源
      最近更新 更多
      热门标签