如何在 Semantic React UI 中扩展 Input 的宽度大小?

Kha*_*ran 4 reactjs semantic-ui semantic-ui-react

我正在使用 Reactjs 项目,并且我使用 Semantic UI React 来美化Input. 但是,似乎Input总是以默认大小显示。如何调整其水平宽度?

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.12/semantic.min.css"></link>

  • 在我导入的js文件中:

import { Input } from 'semantic-ui-react';

  • 并呈现输入:

<Input value={this.state.firstName} onChange={this.handleInputFirstName}/>

Swa*_*nil 9

添加style={{ width:"300px" }}对我来说非常好。我正在使用与您相同的样式表。你可以看看下面的代码:

const App = () => (
  <div style={styles}>
    <h2>Start editing width and see magic happen {'\u2728'}</h2>
    <Input placeholder="Hello there" style={{width: "370px"}}/>
  </div>
);
Run Code Online (Sandbox Code Playgroud)

工作示例可以在这里看到:
编辑 StackOverflow 2