Skip to content

Commit

Permalink
fix(components/transition): 判断触发事件的元素是否绑定事件的元素
Browse files Browse the repository at this point in the history
  • Loading branch information
mengxinssfd committed Jun 8, 2023
1 parent 72ed54d commit 98b8862
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/components/src/transition/transition.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,18 @@ export function addTransition({
};

const handlers = {
start: () => {
start: (e: TransitionEvent) => {
if (e.target !== e.currentTarget) return;
el.removeEventListener('transitionstart', handlers.start);
on(LIFE_CIRCLE.start);
},
cancel() {
cancel(e: TransitionEvent) {
if (e.target !== e.currentTarget) return;
el.removeEventListener('transitioncancel', handlers.cancel);
on(LIFE_CIRCLE.cancel);
},
end() {
end(e: TransitionEvent) {
if (e.target !== e.currentTarget) return;
clearListener();
on(LIFE_CIRCLE.after);
removeClass();
Expand Down

0 comments on commit 98b8862

Please sign in to comment.