【问题标题】:Vaadin 14 - Disable Hovering Response on ButtonsVaadin 14 - 禁用按钮上的悬停响应
【发布时间】:2021-07-02 18:28:11
【问题描述】:

是否可以禁用按钮的悬停功能?我还没有遇到任何促进这一点的方法,所以我猜这里可能需要编写一个自定义函数。

【问题讨论】:

  • 您到底想禁用什么?你有例子吗?
  • @SimonMartinelli 当您将鼠标悬停在按钮上时,例如使用 Lumo Primary 主题设计,颜色会略有变化,直到您再次移出按钮区域
  • 您必须更改按钮 CSS。明天补个例子

标签: vaadin vaadin14


【解决方案1】:

您可以使用 CSS 更改悬停。

添加包含此内容的 CSS 文件。 opacity: 0 将禁用悬停时的更改。

:host(:hover)::before {
    opacity: 0;
}

然后你必须像这样为 vaadin-button 导入它:

@CssImport(value = "./themes/vaadindemo/components/button.css", themeFor = "vaadin-button")

请在此处找到一个运行示例:

https://github.com/simasch/vaadin-examples

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-08-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-26
    • 2018-07-20
    • 2019-01-20
    相关资源
    最近更新 更多