BiYuqi / vue-intersection-observer

Vue component for the Intersection <Observer /> API
https://biyuqi.github.io/vue-intersection-observer
MIT License
35 stars 5 forks source link

prop types for server side #34

Open ulcuber opened 2 years ago

ulcuber commented 2 years ago

Resolves #33

ulcuber commented 2 years ago

@rderks88

Tried vue-intersection-observer

Not compatible with SSR

See: https://github.com/BiYuqi/vue-intersection-observer/issues/33 Workaround: downgrade to 0.1.8

Inline Handlers

this.$emit("on-change", entries[0], this.unobserve); leads to inconveniences with v-for: $event is bound to entries[0] and this.unobserve is lost when using Inline Handlers:

<template v-for="(item, index) in items">
    <observer :key="index" @on-change="onObserveChange(item, $event)">
    </observer>
</template>

See: https://v2.vuejs.org/v2/guide/events.html#Methods-in-Inline-Handlers

Workaround:

(...params) => onObserveChange(item, ...params)

Has dependencies

core-js vue vue-router

Using vue-intersect

But has issues with dynamic components: https://github.com/heavyy/vue-intersect/pull/32

Need to be transpiled

See nuxt.config.js.build.transpile

rderks88 commented 2 years ago

Thank you ulcuber for your swift reply.