fix(transition): handle multiple transition classes (#638) (#645)

fix #638
This commit is contained in:
yang 2020-01-21 01:44:01 +08:00 committed by Evan You
parent 5aa9868512
commit 98d50d874d

View File

@ -200,12 +200,12 @@ export interface ElementWithTransition extends HTMLElement {
}
export function addTransitionClass(el: ElementWithTransition, cls: string) {
el.classList.add(cls)
cls.split(/\s+/).forEach(c => c && el.classList.add(c))
;(el._vtc || (el._vtc = new Set())).add(cls)
}
export function removeTransitionClass(el: ElementWithTransition, cls: string) {
el.classList.remove(cls)
cls.split(/\s+/).forEach(c => c && el.classList.remove(c))
if (el._vtc) {
el._vtc.delete(cls)
if (!el._vtc!.size) {