Sorry to be a pain again. One thing I've noticed. I'm trying to come up with a component that includes both XyzTransition
and XyzTransitionGroup
. The problem is, the XyzTransition
doesn't apply the v-observe-visibility directive argument. But for XyzTransitionGroup
it seems to work just fine.
If I wrap this entire component in a div and add the directive there, it works. Only issue is I now will always have an extra div placed in there, which is not ideal.
<template>
<component
v-bind:is="group ? 'XyzTransitionGroup' : 'XyzTransition'"
v-bind="this.$attrs"
v-bind:on="this.$listeners"
v-observe-visibility="{ callback: visiblityChanged, ...options }"
>
<slot v-if="isVisible" />
</component>
</template>
<script>
export default {
name: 'Animation',
props: {
// Options for vue observer
options: {
type: Object,
default: () => {},
required: false,
},
// Wether its a group transition
group: {
type: Boolean,
required: false,
},
},
data() {
return {
isVisible: false,
}
},
methods: {
visiblityChanged(isVisible, event) {
this.isVisible = isVisible
},
},
}
</script>