问题描述
我正在使用引导程序 3 和 4,并希望在用户单击页面上的任何其他位置时关闭所有弹出窗口。我使用 https://stackoverflow.com/a/21007629/166231(和第 3 条评论)作为实施解决方案的指南。
const hideVisiblePopover = function(): void {
const visiblePopover = KatApp[ "visiblePopover" ];
// Just in case the tooltip hasn't been configured
if ( visiblePopover === undefined || $(visiblePopover).data("bs.popover") === undefined ) return;
// Call this first b/c popover 'hide' event sets visiblePopover = undefined
if ( that.bootstrapVersion == 3 ) {
$(visiblePopover).data("bs.popover").inState.click = false
}
$(visiblePopover).popover("hide");
};
我在所有标记的 div
容器上设置的事件处理程序是:
application.element
.on("show.bs.popover.RBLe",function() { hideVisiblePopover(); })
.on("shown.bs.popover.RBLe",function( e ) {
KatApp[ "visiblePopover"] = e.target;
})
.on("hide.bs.popover.RBLe",function() {
KatApp[ "visiblePopover"] = undefined;
});
但是,在引导程序 5 中,我尝试使用此行获取 bs.popover
:
$(visiblePopover).data("bs.popover")
返回未定义。现在还有别的地方可以找这个吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)