vue-smooth-scrollbar icon indicating copy to clipboard operation
vue-smooth-scrollbar copied to clipboard

SSR Support

Open samuelgoddard opened this issue 6 years ago • 6 comments

Hi mate, really appreciate this port, it's working great on my Vue projects. However, I'm attempting to use this library in a Nuxt project and and stumbling with SSR support. I've noticed this is on your roadmap, do you have any idea when this might get implemented / any guidance to how to approach getting it working so I can potentially look at opening a PR?

Thanks again

samuelgoddard avatar Jun 03 '19 11:06 samuelgoddard

@samuelgoddard hi! for ssr i want to use smooth scrollbar as directive (for example, like vue-quill-editor https://github.com/surmon-china/vue-quill-editor/blob/master/src/ssr.js). In nuxt i used it with <no-ssr> at this moment. Hope this helps 😊

magisters-cc avatar Jun 04 '19 18:06 magisters-cc

Hi, sorry but if you use no-ssr it doesn't render (dynamic) content inside the vue-smooth-scrollbar component. That's mean the app it's not rendered and it remain a spa 😐 Thanks to the support and have a nice day!

DidoMarchet avatar Jun 05 '19 11:06 DidoMarchet

@DidoMarchet I used it with mixin, that checks spa or ssr mode, and for ssr i render markup without scrollbar, and when spa app mounted, i replace static content with content with scrollbar. This methods works for me, but it still not clean solution 🤔

magisters-cc avatar Jun 05 '19 13:06 magisters-cc

Hello there, I think the general approach is not the ideal one, directives should be used for DOM manipulation. So, after some thinking, I went for a pure directive implementation: https://github.com/scaccogatto/smooth-vuebar

This guy supports SSR out of the box and it runs smoothly. Tell me what you think, maybe we can build something better together.

scaccogatto avatar Jun 10 '19 12:06 scaccogatto

Screenshot 2019-07-28 at 22 38 14 Just use ` { mode: client } `

shiliaev avatar Jul 28 '19 19:07 shiliaev

for render (dynamic) content, It maybe should like this:

<template>
  <div ref="scrollArea" class="smooth-scrollbar">
     <div>
       <slot/>
    </div>
  </div>
</template>

for me, it works

Funnyang avatar Aug 26 '19 02:08 Funnyang