Update:随着变化commit:8f1757d,自 UI5 1.84 起可用,值帮助图标可以通过更改valueHelpIconSrc
:
<Input showValueHelp="true"
valueHelpIconSrc="sap-icon://sys-help"
valueHelpRequest="alert('Help requested')"
/><!-- valueHelpIconSrc available since 1.84.0 -->
无需延长sap.m.InputBase
在这种情况下。其他输入控件如sap.m.MaskInput
仍然需要扩展,如下面链接的 Plunk 所示。
原答案:
最好的解决方案就像Datum上面有一个小图标,我可以点击它。 (...) 是否可以?
是的,这是可能的。这里有一个最小的例子: https://embed.plnkr.co/EzlF2tkvalJWvSEn
For this, UI5 provides the API addEndIcon
api which is protected, meaning it should be used only when extending sap.m.InputBase
!
As an argument for the addEndIcon
, you can pass a map of settings that are required to create sap.ui.core.Icon
api, which is highly customizable.
const icon = this.addEndIcon({
id: this.getId() + "-questionMarkBtn",
src: IconPool.getIconURI("sys-help"),
noTabStop: true,
tooltip: "Information",
press: [this.onEndButtonPress, this],
}); // See sap.ui.core.Icon/properties for more settings
// icon.addStyleClass(...); if even more customization required..