xwpongithub / vue-range-slider

A range slider component based on vue (Vue滑块组件).
MIT License
122 stars 66 forks source link

Navigator is not defined #8

Open CyrilDebon opened 4 years ago

CyrilDebon commented 4 years ago

Hi, I tried to follow the nuxt usage of the component and made it worked and custom perfectly but when I want to refresh my page, I got a navigator is not defined. I'm working on nuxt and tried to follow the four steps but I don't really understand how to execute the step 3 and 4 of the guide. It's really sad that i have to give up on this well made and documented component !

cobbie commented 4 years ago

Ran into the exact same issue, also using Nuxt. I think this identifies the issue:

https://stackoverflow.com/questions/56319250/fixing-referenceerror-navigator-is-not-defined

You are trying to run code intended for a browser on the server

olekon commented 4 years ago

This helped me https://github.com/NightCatSama/vue-slider-component/issues/114#issuecomment-353827607

But I had to wrap the component like this

<client-only>
            <vue-range-component
                :value="value"
                :min="min"
                :max="max"
                @input="onInput"
            />
</client-only>