maoberlehner / vue-lazy-hydration

Lazy Hydration of Server-Side Rendered Vue.js Components
MIT License
1.18k stars 52 forks source link

Conditional lazy hydration #47

Open simplenotezy opened 4 years ago

simplenotezy commented 4 years ago

It would be cool if you could have a parameter to set if you want to "disable" lazy hydration. E.g.:

<LazyHydrate :enabled="false">

I work with dynamic user defined components, and sometimes I'd like to disable LazyHydrate if a certain condition is met (e.g. "disable_lazy_load").

maoberlehner commented 4 years ago

Not exactly what you want but as a workaround you can use triggerHydration.

<LazyHydrate when-visible trigger-hydration="disable_lazy_load">
  <!-- ... -->
</LazyHydrate>
simplenotezy commented 3 years ago

Can you elaborate a bit on this @maoberlehner? Would this allow me to manually trigger a hydration? E.g. I could use "on-interaction" and then also have a trigger-hydration that would trigger once the element is visible? Or some other condition.