NightCatSama / vue-slider-component

🌡 A highly customized slider component
https://nightcatsama.github.io/vue-slider-component
MIT License
2.39k stars 341 forks source link

ReferenceError: document is not defined with Nuxt.js 2.2.0 when adding import in component #660

Closed ybabenkoJapp closed 1 year ago

ybabenkoJapp commented 1 year ago

Describe the bug

A clear and concise description of what the bug is.

Hi! I added the import for local use in my component as described in the docs

here is my code


<template>
  <div class="range-slider-wrapper">
    <div class="range-slider-container mb-14">
      <vue-slider
        v-model="sliderValue"
        tooltip="none"
        v-bind="options"
        :data="dataArray"
        :data-value="'value'"
        :data-label="'label'"
        :interval="1"
        :min="1"
        :max="3"
      ></vue-slider>
    </div>
  </div>
<template>

<script lang="ts">
import { Prop, Vue } from 'vue-property-decorator';
import Component from 'vue-class-component';
import VueSlider from 'vue-slider-component';
import { IRangeSlider } from '~/types/ISlider';
import 'vue-slider-component/theme/default.css';

@Component({
  components: {
    VueSlider,
  },
})
export default class RangeSliderComponent extends Vue {
my code is here
}
</script>

and I got this error

ReferenceError document is not defined

Additional context (If there is no relevant content, please delete the block)

I have read recently these issues but it didn't help me: https://github.com/NightCatSama/vue-slider-component/issues/75 https://github.com/NightCatSama/vue-slider-component/issues/134

I don't want to use VueSlider globally as a plugin. Can you help me to understand what is wrong?

Add any other context or screenshots about the feature request here.

Environment (If you feel unrelated, please delete the block)

Screenshot 2022-11-07 at 12 15 07
NightCatSama commented 1 year ago

Try using this:

image

https://nightcatsama.github.io/vue-slider-component/#/?hash=server-side-rendering-ssr

ybabenkoJapp commented 1 year ago

@NightCatSama thank you it really helped