首页 > 解决方案 > 为什么打开弹出框关闭选择?

问题描述

当鼠标悬停在选择控件的选项上时,我试图打开弹出框,但每次弹出框打开时,选择都会关闭。

_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();
},

标签: selectsapui5popover

解决方案


这是因为弹出框和下拉列表都使用相同的 id“sap-ui-static”呈现。创建一个弹出框并打开它;并使用调试器工具检查 html 元素。您将看到它呈现在 ID 为“sap-ui-static”的 DIV 元素下。

创建一个选择元素,然后打开下拉列表;; 并使用调试器工具检查 html 元素。您将看到列表呈现在 ID 为“sap-ui-static”的 DIV 元素下。


推荐阅读