【问题标题】:Meteor accounts {{> atForm }} not showing流星帐户 {{> atForm }} 未显示
【发布时间】:2016-11-20 04:33:29
【问题描述】:

我在基于 React 的 Meteor 应用程序中显示标准 Meteor 用户帐户登录模板 {{> atForm }} 时遇到问题。

我正在使用包装器组件在我的 React 应用程序中显示基于 Blaze 的模板。我正在尝试实现 Meteors useraccounts 包的标准登录表单。但是,当我在 Blaze 模板中使用 {{> atForm }} 时,不会显示登录表单。但是,当我锁定特定状态时,例如 {{> atForm state='signUp'}} 会显示表单。

包装器组件

import React, {Component} from 'react';
import ReactDOM from 'react-dom';
export default class AccountsUI extends Component{

componentDidMount() {
    this.view = Blaze.render(Template.LoginTemplate,
    ReactDOM.findDOMNode(this.container));
}


componentWillUnmount(){
    Blaze.remove(this.view);
}

render () {
    return <span ref={(ref) => this.container = ref} />
}
}

Blaze 模板

<template name="LoginTemplate">
    {{> atForm }} //Not displayed
    {{> atForm state='signUp'}} // Displayed
</template>

但也不会显示其他内部状态,例如 {{> atForm state='signIn'}}

.meteor 中的包

useraccounts:unstyled
accounts-password

你有什么建议为什么会这样,我该如何解决这个问题? 提前致谢。

【问题讨论】:

    标签: meteor reactjs meteor-blaze meteor-accounts meteor-react


    【解决方案1】:

    答案由我自己解决。问题是,当我重写我的代码时,我已经登录了。所以唯一缺少的就是注销。因此,如果有人遇到同样的问题,请务必在应用程序中检查您是否已经登录。如果是这样,请务必先注销,然后再将 {{> atForm}} 添加到您的模板中。

    【讨论】:

      【解决方案2】:

      在我的情况下,卸载 accounts-ui 似乎可以解决这个问题

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-06-05
        • 1970-01-01
        • 2017-11-20
        • 2013-10-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多