0
我正在玩有希望的meteor框架,並打了一堵牆。在模板的任何位置插入{{#if something}}{{/if}}
會導致呈現空白頁面。考慮此模板:爲什麼在流星模板中插入#if空格鍵會導致空頁面被渲染?
<head>
<title>MUse - XUse on Meteor</title>
</head>
<body>
{{> menu}} {{> login }}
{{> hello}}
</body>
<template name="hello">
<div class="hello">
<h1>This is Xuse on Meteor a.k.a. <em>MUse</em></h1>
</div>
</template>
<template name="login">
<div class="login">
<label for="username">Login:</label>
<input type="text" id="username" value="" placeholder="Login"/>
<label>Password:</label>
<input type="password" id="password" value="" placeholder="Password"/>
<input type="button" id="signin" name="signin" value="Sign in" />
</div>
</template>
<template name="dashboard">
<div class="dashboard">
Hi, {{login_name}}.
</div>
</template>
<template name="menu">
<nav>
<a href="/#dashboard">Dashboard</a> |
<a href="/#logout">Log out</a> |
{{#if login_name}}
<a href="/#{{login_name}}">{{login_name}}</a>
{{/if}}
</nav>
</template>
和公正的情況下,coffeescript
代碼:
if Meteor.is_client
Template.hello.greeting = -> "Welcome to muse."
Template.login.events =
'click #signin' : ->
console.log "You pressed the 'sign in' button" if console?
login_name = $('#username').val()
password = $('#password').val()
console.log "Credentials: #{login_name} -> #{password}" if console?
Template.menu.events =
'click a[href*="dashboard"]' : ->
console.log "Menu -> Dashboard invoked" if console?
'click a[href*="logout"]' : ->
console.log "Menu -> Log out invoked" if console?
if Meteor.is_server
Meteor.startup ->
time = new Date
console.log "#{time} Hi. This is server" if console?
這一切 - 僅此而已。刪除{{#if...}}
序列會導致正確的渲染,而將其保留或放置在任何有意義的位置都會呈現空白頁面。任何線索?
我曾嘗試todos的例子,它在同一臺機器上工作,所以這不是一個安裝問題。順便說一句,這臺機器是一個可憐的舊筆記本電腦華碩A6Rp與Ubuntu 12.04板上。
謝謝,就是這樣。 – Rajish 2012-04-13 21:12:44