viktorlarsson / vue-tiny-slider

Vanilla javascript slider for all purposes created by ganlanyuan in Vue.
MIT License
136 stars 51 forks source link

does not work with SSR in production mode (nuxt build) #80

Closed davidkobielski closed 2 years ago

davidkobielski commented 2 years ago

When application is in development mode tiny slider works perfectly, but when I want to build my app it doesn't work. Above is my code. A did everything the same as it is in the readme file.

My component

<client-only> 
  <vue-tiny-slider v-bind='tinySliderOptions'>
    <Product v-for='product in products' :key='product.id' :product="{url: '...', alt: '...', name: product.name, images: getImages(product.images), price: product.regular_price}"/>
  </vue-tiny-slider>
</client-only>

plugins/vue-tiny-slider.js

import Vue from "vue";
import vTinySlider from "vue-tiny-slider";
const VueTinySlider = {
 install(Vue, options) {
    Vue.component("vue-tiny-slider", vTinySlider);
 }
};  
Vue.use(VueTinySlider);
export default VueTinySlider;

nuxt.config.js

{ src: "~/plugins/vue-tiny-slider.js", mode: 'client' }
davidkobielski commented 2 years ago

Nvm, I'm just stupid. I didnt import tiny-slider's css styles.