在 Vaadin Flow 14 中为“选择"小部件设置工具提示提示 [英] Set tooltip hint for `Select` widget in Vaadin Flow 14
本文介绍了在 Vaadin Flow 14 中为“选择"小部件设置工具提示提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Vaadin 14.1 中,TextField
小部件提供了一个 setTitle
方法.我们可以将字符串传递给该方法,文本在运行时显示为浮动 tooltip 消息当用户将鼠标指针悬停时.
In Vaadin 14.1, the TextField
widget offers a setTitle
method. We can pass a string to that method, with the text appearing at runtime as a floating tooltip message when the user hovers their mouse pointer.
令人惊讶的是,Select
小部件缺少 setTitle
方法.
Surprisingly, the Select
widget lacks a setTitle
method.
➥ 有什么方法可以获得同样的工具提示行为吗?
➥ Is there some way to get this same tooltip behavior?
推荐答案
你基本可以访问 DOM,可以直接添加 title
属性.例如
You have access to the DOM basically and can directly add a title
attribute. E.g.
select.getElement().setAttribute('title', 'This is a title')
这篇关于在 Vaadin Flow 14 中为“选择"小部件设置工具提示提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文