【问题标题】:reactjs material-ui how to style auto complete which always cover the text fieldreactjs material-ui 如何设置始终覆盖文本字段的自动完成样式
【发布时间】:2016-05-11 20:49:28
【问题描述】:

我对自动完成有点问题。

我的 API 返回了很多数据,当我在自动完成搜索栏中键入一个单词时,下拉菜单会隐藏文本输入。

我试图覆盖样式:

<AutoComplete
    hintText="For example, Coca-Cola"
    floatingLabelText="Search entities"
    onUpdateInput={this.updateInput}
    dataSource={autoCompleteDataSource}
    filter={this.caseInsensitiveFilter}
    menuStyle={styles}
    ref="searchBox" />


 var styles = {
   top: '53%'
 };

但这根本不起作用(也许我试图以错误的方式覆盖它?)。

有人知道吗?

非常感谢!

【问题讨论】:

  • 大量数据 - 100、1000 是什么意思?
  • 您好,谢谢您的回答。知道这一点有什么帮助?
  • 因为我无法重现它(尝试了 100 个选项)。你用的是什么material-ui版本?
  • 哦,好的,我使用的是0.14.2 版本!我想我也有大约 100 个选项。

标签: reactjs material-ui


【解决方案1】:

使用anchorOrigin,这是自动完成的锚点位置。它有一个默认值 { vertical: 'bottom', Horizo​​ntal: 'left' }。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-04-08
    • 2022-08-09
    • 2020-07-30
    • 2016-06-17
    • 1970-01-01
    • 2020-02-21
    • 1970-01-01
    • 2020-01-30
    相关资源
    最近更新 更多