parent
724b3732a0
commit
0ee7ddc6a1
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@bd/core",
|
||||
"version": "1.8.2",
|
||||
"version": "1.8.3",
|
||||
"type": "module",
|
||||
"description": "百搭UI组件库的核心",
|
||||
"main": "dist/index.js",
|
||||
|
|
|
@ -13,15 +13,18 @@ export function animate(duration = 200, fromto = [], out = false) {
|
|||
direction: out ? 'reverse' : 'normal',
|
||||
fill: 'forwards'
|
||||
})
|
||||
if (out) {
|
||||
return new Promise(resolve => {
|
||||
res.addEventListener(
|
||||
'finish',
|
||||
_ => {
|
||||
this.style.display = 'none'
|
||||
if (out) {
|
||||
this.style.display = 'none'
|
||||
}
|
||||
resolve()
|
||||
},
|
||||
{ once: true }
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
export const MODES = {
|
||||
fade: [{ opacity: 0 }, { opacity: 1 }],
|
||||
|
|
|
@ -631,7 +631,7 @@ class AnimPart extends AttributePart {
|
|||
fromto = custom
|
||||
}
|
||||
this.element.$animate = function (out = false) {
|
||||
animate.call(this, duration, fromto, out)
|
||||
return animate.call(this, duration, fromto, out)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ export class Component extends HTMLElement {
|
|||
Object.defineProperty(this.prototype, '$animate', {
|
||||
value(out) {
|
||||
if (this[__mounted__]) {
|
||||
animate.call(this, duration, MODES[type], out)
|
||||
return animate.call(this, duration, MODES[type], out)
|
||||
}
|
||||
},
|
||||
enumerable: false
|
||||
|
|
Loading…
Reference in New Issue