使用 Amplify 实现的登录表单未应用样式

min*_*uki 4 amazon-web-services reactjs aws-amplify

我在日语论坛上问了同样的问题,但没有得到答复,所以我在这个网站上提问。

这个问题是关于 AWS Amplify。

我正在尝试使用 Amplify 的 React 和 withAuthenticator() 实现登录表单,参考 AWS 文档(https://aws-amplify.github.io/docs/js/authentication),但我的登录表单与示例不同文档和 css 的 UI 不会像下图这样应用。

我可以登录和注册。

有什么办法可以解决这个问题吗?

我的登录表单由 withAuthenticator()

import Amplify from 'aws-amplify';
import awsconfig from './aws-exports';
import { withAuthenticator } from 'aws-amplify-react';

Amplify.configure(awsconfig);

function App() {
  return (

  );
}

export default withAuthenticator(App); 
Run Code Online (Sandbox Code Playgroud)

我清除了缓存但没有工作。

Chrome的开发工具也没有错误。

对不起,我的英语不好。

小智 6

尝试使用@aws-amplify/ui-react代替aws-amplify-react.

import { withAuthenticator } from '@aws-amplify/ui-react';
Run Code Online (Sandbox Code Playgroud)


Sam*_*nda 6

在您的 app.js 中添加以下输入端口

import '@aws-amplify/ui/dist/style.css';
Run Code Online (Sandbox Code Playgroud)