小编lai*_*man的帖子

在 react-select 中正确使用 NoOptionsMessage 来更改“无选项”文本

我正在尝试更改react-select? 我能够使用以下代码做到这一点

<AsyncSelect 
    styles={customStyles} 
    components={{ DropdownIndicator: () => null, IndicatorSeparator: () => null, NoOptionsMessage: () => "test" }} 
    className="form-control firm-search"
    cacheOptions
    defaultOptions
    value={selectedValue}
    getOptionLabel={e => e.name}
    getOptionValue={e => e.path}
    loadOptions={loadOptions}
    onInputChange={handleInputChange}
    onChange={handleChange}
    placeholder='test ...'
/>
Run Code Online (Sandbox Code Playgroud)

问题是文本不再样式化。是否可以更改文本但保留默认样式?如果没有,是否可以将 CSS 应用于新文本?

reactjs react-select

5
推荐指数
2
解决办法
1424
查看次数

标签 统计

react-select ×1

reactjs ×1