mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-15 17:14:05 -08:00
31 lines
591 B
Vue
31 lines
591 B
Vue
|
<template>
|
||
|
<span ref="observed">
|
||
|
<slot></slot>
|
||
|
</span>
|
||
|
</template>
|
||
|
|
||
|
<script lang="ts">
|
||
|
|
||
|
import mixins from 'vue-typed-mixins';
|
||
|
import emitter from '@/components/mixins/emitter';
|
||
|
|
||
|
export default mixins(emitter).extend({
|
||
|
name: 'IntersectionObserved',
|
||
|
props: ['enabled'],
|
||
|
mounted() {
|
||
|
if (!this.$props.enabled) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
this.$nextTick(() => {
|
||
|
this.$dispatch('IntersectionObserver', 'observe', this.$refs.observed);
|
||
|
});
|
||
|
},
|
||
|
beforeDestroy() {
|
||
|
if (this.$props.enabled) {
|
||
|
this.$dispatch('IntersectionObserver', 'unobserve', this.$refs.observed);
|
||
|
}
|
||
|
},
|
||
|
});
|
||
|
</script>
|