【发布时间】:2018-07-31 02:59:18
【问题描述】:
我想使用 react-select 中的 <Select /> 组件,所以我从组件的站点 https://jedwatson.github.io/react-select/ 复制了一个示例
import React, {Component, Fragment} from 'react'
import Select from 'react-select'
import 'react-select/dist/react-select.css'
export default class Test extends Component {
constructor(props) {
super(props)
}
render() {
return (
<Fragment>
<Select
name="form-field-name"
value='hello'
onChange={this.handleChange}
options={[
{ value: 'one', label: 'One' },
{ value: 'two', label: 'Two' },
]}
/>
</Fragment>
)
}
}
我应该怎么做才能使它看起来像这样?
【问题讨论】:
-
好吧,我们看不到你的 CSS 或其他任何东西,所以很难提供帮助。
-
我只是在使用组件的 CSS 'react-select/dist/react-select.css' @Dave Newton
标签: javascript reactjs react-select