Skip to content

Commit

Permalink
优化 弹窗之后背景还是可以滑动的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
BearJ committed Jul 19, 2018
1 parent 881ac0d commit f19eb33
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/dialog/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,19 @@ function dialog(options = {}) {
$mask.addClass('weui-animate-fade-in');
$dialog.addClass('weui-animate-fade-in');

$dialogWrap.on('click', '.weui-dialog__btn', function (evt) {
const index = $(this).index();
if (options.buttons[index].onClick) {
if (options.buttons[index].onClick.call(this, evt) !== false) hide();
} else {
hide();
}
});
$dialogWrap
.on('click', '.weui-dialog__btn', function(evt){
const index = $(this).index();
if(options.buttons[index].onClick){
if(options.buttons[index].onClick.call(this, evt) !== false) hide();
}else{
hide();
}
})
.on('touchmove', function(evt){
evt.stopPropagation();
evt.preventDefault();
});

_sington = $dialogWrap[0];
_sington.hide = hide;
Expand Down

0 comments on commit f19eb33

Please sign in to comment.