如何将对象传递给aws-amplify-vue SignUp?

时间:2018-09-30 14:46:42

标签: vue.js vue-component amazon-cognito aws-amplify

我正在Vue应用中使用AWS-amplify amplify Authentication Components

这使我可以轻松地使用Amazon Cognito注册和验证用户。不幸的是,我无法更改注册组件,以显示其他字段,并删除phone_number作为必填字段。

欢迎任何帮助! 最好的问候

2 个答案:

答案 0 :(得分:2)

这就是我的方法。以防万一有人发现这个问题。

<amplify-authenticator :authConfig='authConfig'></amplify-authenticator>
data() {
    return {
        authConfig: {
            signUpConfig: {
                header: 'Sign up for an account',
                hiddenDefaults: ['phone_number', 'username'],
                signUpFields: [
                    {
                        label: 'Email',
                        key: 'email',
                        type: 'string',
                        required: true,
                        displayOrder: 0
                    },
                    {
                        label: 'Password',
                        key: 'password',
                        type: 'password',
                        required: true,
                        displayOrder: 1
                    }
                ]
            },
            confirmSignUpConfig: {
                header: 'Please enter the code sent to your email'
            },
        }
    }
},

答案 1 :(得分:-1)

您需要绑定到v-bind:authOptions,文档参考了v-bind:authConfig,这是错误的。

我希望这会对您有所帮助。