Skip to content
This repository was archived by the owner on Jan 8, 2025. It is now read-only.

Commit a4f729b

Browse files
committed
chore: make up the animation
1 parent 7cc30e1 commit a4f729b

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

packages/varlet-vue2-cli/site/components/teleport/Teleport.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default defineComponent({
3333
},
3434

3535
transfer() {
36-
const container = this.disabled ? this.$refs.teleport : document.querySelector(this.to)
36+
const container = this.disabled ? this.$refs.teleport : (typeof this.to === 'string'? document.querySelector(this.to): this.to)
3737
const parentNode = this.el.parentNode
3838

3939
if (parentNode === container) {

packages/varlet-vue2-cli/site/components/teleport/props.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export const props = {
22
to: {
3-
type: String,
43
required: true,
54
},
65
disabled: {

packages/varlet-vue2-cli/site/pc/components/AnimationBox.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ export default defineComponent({
1414
}),
1515
created() {
1616
floating.animationBoxData = this.$attrs;
17-
},
18-
mounted() {
19-
floating.animationEl = this.$refs.varletLogoAnimationRef
20-
floating.animationElClientRect = this.$refs.varletLogoAnimationRef.getBoundingClientRect();
2117
this.mutationObserver = new MutationObserver(() => {
2218
floating.animationElClientRect = this.$refs.varletLogoAnimationRef?.getBoundingClientRect();
2319
});
2420
this.mutationObserver.observe(document.body, { attributes: true, subtree: true, childList: true });
2521
},
22+
mounted() {
23+
floating.animationEl = this.$refs.varletLogoAnimationRef
24+
floating.animationElClientRect = this.$refs.varletLogoAnimationRef.getBoundingClientRect();
25+
},
2626
beforeUnmount() {
2727
this.mutationObserver && this.mutationObserver.disconnect();
2828
},

packages/varlet-vue2-cli/site/pc/components/LogoAnimation.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<template>
22
<div>
3-
<teleport to="#varletLogoAnimationRef" v-if="animationEl && !floatingState">
3+
<teleport :to="animationEl" v-if="animationEl">
44
<img v-show="!floatingState && logo" v-bind="animationBoxData" :style="styles" :src="logo" alt="logo" class="varlet-cli-logo-animation" />
55
</teleport>
6-
{{Boolean(animationEl)}}
76
<div v-show="floatingState">
87
<img @transitionend="land" v-bind="animationBoxData" :style="styles" :src="logo" alt="logo"
98
v-if="logo && animationEl"
@@ -58,6 +57,7 @@ export default defineComponent({
5857
window.addEventListener('resize', this.resetPosition, false);
5958
},
6059
beforeUnmount() {
60+
this.resetTimer && clearTimeout(this.resetTimer)
6161
window.removeEventListener('resize', this.resetPosition);
6262
},
6363
created(){

0 commit comments

Comments
 (0)