【问题标题】:md-autocomplete md-clear-button="true" does not show the clear buttonmd-autocomplete md-clear-button="true" 不显示清除按钮
【发布时间】:2017-05-30 13:47:44
【问题描述】:

<md-autocomplete> 组件有问题,在this demo 中显示:

<md-autocomplete md-clear-button="true"> 不起作用。我希望输入字段的末尾会显示一个叉号,就像官方Basic Usage demo 显示的那样。

如果有人可以更新我的演示以便清除按钮起作用,我将不胜感激。

【问题讨论】:

    标签: javascript angularjs angular-material md-autocomplete


    【解决方案1】:

    这实际上在当前版本v1.1.4 中运行良好(可能高于 v1.1.2)。见demo here

    此外,根据一些 GitHub 问题(#2727#7800),这似乎是在将 md-floating-label 用于 md-autocomplete 时的故意行为

    如果您无法选择更新angular-material 版本,您可以查看this comment,结果证明这是一个颇受好评的解决方法。

    希望有帮助!

    【讨论】:

    • 感谢您的努力。也许您已经注意到在我的演示中,我尝试使用一个 CSS 规则为所有输入字段添加顶部填充,但是它使 md-autocomplete 错误地计算交叉的位置以及下拉列表。您认为这是一个错误还是使用 CSS 可以相对容易地解决?
    • codepen.io/anon/pen/vdbpYv?editors=1010 ..md-自动完成重置不起作用
    【解决方案2】:

    将您的 angularjs-material 版本更新到 1.1.2 及更高版本。只需比较版本1.1.0 (under the attributes section)1.1.2 (there's a dedicative section for md-clear-button attribute)

    注意: Google 似乎没有为 1.1.2 及更高版本提供 angularjs-material。请改用cdnjs

    更新:Google 现在为 1.1.2 及更高版本提供 angularjs-materialMore info

    这是updated fiddle

    【讨论】:

    • 感谢您的关注!也许这就是我没有选择最新版本库的原因:我无法在 Google 网站上找到它。
    • @dma_k 看起来 Google 现在提供 1.1.2 及更高版本!
    • codepen.io/anon/pen/vdbpYv?editors=1010 ..md-自动完成重置不起作用
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-31
    • 1970-01-01
    • 2015-08-08
    • 2019-12-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多