Skip to content

Commit

Permalink
修复Dcat.init监听会被异步弹窗解绑问题
Browse files Browse the repository at this point in the history
  • Loading branch information
jqhph committed Dec 6, 2020
1 parent e6ea5b3 commit 13a2fba
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
32 changes: 17 additions & 15 deletions resources/assets/dcat/js/Dcat.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,28 +112,30 @@ export default class Dcat {
}
};

$document.one('pjax:loaded', clear);
$document.one('pjax:complete', clear);
$document.one('init:off', clear);

clear();

initialized[selector] = $.initialize(selector, function () {
let $this = $(this),
id = $this.attr('id');
setTimeout(function () {
initialized[selector] = $.initialize(selector, function () {
let $this = $(this),
id = $this.attr('id');

if ($this.attr('initialized')) {
return;
}
$this.attr('initialized', '1');
if ($this.attr('initialized')) {
return;
}
$this.attr('initialized', '1');

// 如果没有ID,则自动生成
if (! id) {
id = "_"+self.helpers.random();
$this.attr('id', id);
}
// 如果没有ID,则自动生成
if (! id) {
id = "_"+self.helpers.random();
$this.attr('id', id);
}

callback.call(this, $this, id)
}, options);
callback.call(this, $this, id)
}, options);
});
}

offInit() {
Expand Down
2 changes: 1 addition & 1 deletion resources/dist/dcat/js/dcat-app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion resources/dist/dcat/js/dcat-app.js.map

Large diffs are not rendered by default.

0 comments on commit 13a2fba

Please sign in to comment.