0
當我返回模板助手內部不是靜態的東西時,Meteor拋出一個錯誤「Deps重新計算:用戶名異常」。流星投擲「Deps重新計算的例外」
Router.configure({
layoutTemplate: 'layout'
});
Router.map(function() {
this.route('home', {path: '/'});
this.route('dashboard');
})
if (Meteor.isClient) {
Accounts.ui.config({
passwordSignupFields: 'USERNAME_AND_EMAIL'
});
Template.dashboard.helpers({
username: function() {
return Meteor.user().username;
}
});
}
<template name="layout">
<h1>Layout</h1>
{{yield}}
</template>
<template name="home">
{{#link route='dashboard'}}Dashboard{{/link}}
</template>
<template name="dashboard">
{{#link route='home'}}Home{{/link}}
{{username}}
</template>
奇怪的是,通過點擊在家裏模板中的鏈接訪問儀表板路由時,一切工作正常。但是當我在url欄中鍵入/儀表板時,我得到了那個錯誤。
謝謝:)如何讓我的路由器等待登錄過程運行? – zimt28
我還沒有從流星路由器遷移到鐵路路由器,所以我不能告訴你我爲此做了什麼。我實際上有點驚訝它不在文檔中,因爲這是一個常見的用例。看看[這個](https://github.com/EventedMind/iron-router/issues/286)問題的一些建議。 –