select - 为什么打开弹出框关闭选择?
问题描述
当鼠标悬停在选择控件的选项上时,我试图打开弹出框,但每次弹出框打开时,选择都会关闭。
_assignMouseOverPopover: function (select, popover) {
var items = select.getItems();
items.forEach(element => {
element.addEventDelegate({
onmouseover: this._showHoverPopover.bind(this, popover, element),
onmouseout: this._hideHoverPopover.bind(this, popover)
})
})
},
_showHoverPopover: function (popover, element, select) {
this._timeId = setTimeout(() => {
popover.openBy(element);
}, 100);
},
_hideHoverPopover: function (popover){
clearTimeout(this._timeId) || popover.close();
},
解决方案
这是因为弹出框和下拉列表都使用相同的 id“sap-ui-static”呈现。创建一个弹出框并打开它;并使用调试器工具检查 html 元素。您将看到它呈现在 ID 为“sap-ui-static”的 DIV 元素下。
创建一个选择元素,然后打开下拉列表;; 并使用调试器工具检查 html 元素。您将看到列表呈现在 ID 为“sap-ui-static”的 DIV 元素下。
推荐阅读
- python - 如何在pyspark窗口分区执行自定义逻辑
- java - 如何在自定义组件(HarmonyOS)中获取PNG格式图标作为属性
- javascript - 如何防止 XState 节点在接收事件时重置其子并行状态?
- google-ads-api - 您好,我无法从 google ads API 创建帐户
- rest - wso2 创建新用户并使用 REST API 分配角色
- mongodb - 查询嵌套文档数组的多个值
- python - 如何处理“不能在引号括起来的字符串后指定额外字符”错误?
- notepad++ - Notepad ++在每行的第n个字符中插入一个单词(向后)
- python - 如何为模板创建无限数量的标题
- python - 如何使用 django 解决 web 调用的 python 模型