我已经实现了这个 Angular 多选下拉列表。 http://dotansimha.github.io/angularjs-dropdown-multiselect/#/
它具有以下方法,可以持续跟踪事件以关闭打开的下拉菜单。
if ($scope.settings.closeOnBlur) {
$document.on('click', function (e) {
// some code here
});
}
您可以在以下位置找到此方法 https://github.com/dotansimha/angularjs-dropdown-multiselect/blob/master/src/angularjs-dropdown-multiselect.js
这种方法使我的 angularJS 页面变得很重,从而降低了性能。
可以采取什么替代措施?
谢谢。
最佳答案
我在多选模块中添加了对模板生成的优化,以便下拉列表是延迟生成的,从而显着减少了监视的数量。 这应该会加快您的页面加载速度和点击事件的行为。
我提交了pull-request ,但存储库似乎不经常维护。 您可以通过here查看
大部分功劳归于gilad
关于javascript - 由于文档的点击事件,angularjs 多选下拉菜单使页面变得沉重,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31891118/