Skip to content

Commit

Permalink
* core: support to bind inited event globally.
Browse files Browse the repository at this point in the history
  • Loading branch information
catouse committed Jan 12, 2024
1 parent a00ce81 commit 3bc1e08
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/core/src/helpers/global-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ function handleGlobalEvent(this: Cash, event: Event) {
}
}

$(document).on('click.helpers.zt change.helpers.zt', '[data-on]', handleGlobalEvent);
$(document).on('click.global.zui change.global.zui inited.global.zui', '[data-on]', handleGlobalEvent);
6 changes: 6 additions & 0 deletions lib/core/src/helpers/zui-creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ $.fn.zuiInit = function (this: Cash) {
});
this.find('.hide-before-init').removeClass('invisible hidden opacity-0');
this.find('.scroll-into-view').scrollIntoView();
this.find('[data-on="inited"]').each((_, ele) => {
const $ele = $(ele);
if (!$ele.zui()) {
$ele.trigger('inited');
}
});
return this;
};

Expand Down

0 comments on commit 3bc1e08

Please sign in to comment.