Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e866592

Browse filesBrowse files
Mrlilililiyan1
and
liyan1
authored
fix(useAnimate): Correct condition for updating keyframes (#4619)
Co-authored-by: liyan1 <liyan1@joyy.com>
1 parent 13393b1 commit e866592
Copy full SHA for e866592

File tree

1 file changed

+9
-7
lines changed
Filter options

1 file changed

+9
-7
lines changed

‎packages/core/useAnimate/index.ts

Copy file name to clipboardExpand all lines: packages/core/useAnimate/index.ts
+9-7
Original file line numberDiff line numberDiff line change
@@ -233,15 +233,17 @@ export function useAnimate(
233233
})
234234

235235
watch(() => keyframes, (value) => {
236-
if (animate.value)
236+
if (animate.value) {
237237
update()
238238

239-
if (!unrefElement(target) && animate.value) {
240-
animate.value.effect = new KeyframeEffect(
241-
unrefElement(target)!,
242-
toValue(value),
243-
animateOptions,
244-
)
239+
const targetEl = unrefElement(target)
240+
if (targetEl) {
241+
animate.value.effect = new KeyframeEffect(
242+
targetEl,
243+
toValue(value),
244+
animateOptions,
245+
)
246+
}
245247
}
246248
}, { deep: true })
247249

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.