AWS Vue Amplify-缺少预构建注销组件

时间:2020-06-03 19:23:36

标签: amazon-web-services vue.js aws-amplify gridsome aws-amplify-vue

我已经在Gridsome Vue应用程序上使用Cognito进行用户登录并按预期工作,但是我注意到“退出”按钮只有在未包装在<amplify-authenticator>标签中的情况下才会显示。文档只是过时的还是损坏的?

示例,而不是:

<amplify-authenticator>
    <amplify-sign-out></amplify-sign-out>
</amplify-authenticator>

我正在写:

<amplify-sign-out></amplify-sign-out>

哪个工作。

此操作不遵循the docs,但除此之外,它似乎按预期运行。

这是我在main.js中将Amplify添加到我的Gridsome项目中的方法:

import Amplify, * as AmplifyModules from "aws-amplify"
import { AmplifyPlugin, components } from "aws-amplify-vue"
import aws_exports from "./aws-exports"
import "@aws-amplify/ui-vue"
Amplify.configure(aws_exports)

...

export default function(Vue, { router, head, isClient, appOptions }) {


    // Expose this.$Amplify in components
    Vue.use(AmplifyPlugin, AmplifyModules)

1 个答案:

答案 0 :(得分:0)

成功登录Authenticator组件后,您将看到带有共享示例的“退出”按钮。

<amplify-authenticator>
    <amplify-sign-out></amplify-sign-out>
</amplify-authenticator>

<amplify-sign-out></amplify-sign-out>按钮放在<amplify-authenticator>标签之外将使它始终显示“注销”。