Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: document is not defined #134

Closed
99percent6 opened this issue Dec 6, 2017 · 2 comments
Closed

ReferenceError: document is not defined #134

99percent6 opened this issue Dec 6, 2017 · 2 comments

Comments

@99percent6
Copy link

99percent6 commented Dec 6, 2017

Hi!
I use slider in another vue-component on localhost.
After adding slider to the template it is displayed on the page, but when update this page i see 500 | Internal Server Error and in a Terminal ReferenceError: document is not defined.
<template> <div class="sidebar"> <price-slider v-model="value" v-bind="options"> </price-slider> </div> </div> </template>

Also i tried this variant template:
<template> <div class="sidebar"> <no-ssr> <price-slider v-model="value" v-bind="options"> </price-slider> </no-ssr> </div> </div> </template>

import PriceSlider from 'vue-slider-component'
export default { components: { ColorButton, SizeButton, PriceButton, RangeSlider, 'no-ssr': NoSSR, **PriceSlider** }, data () { return { sliderValue: 50, value: [0, 100] } }, mixins: [coreComponent('core/blocks/Category/Sidebar')]

What am I doing wrong?

@NightCatSama
Copy link
Owner

I am sorry, I have not tried to use components for ssr, you can refer to other people's solutions.

Using it with NUXT.js

issue#75

@99percent6
Copy link
Author

Added this code:
if (process.browser) { // in older versions of nuxt, it's process.BROWSER_BUILD let VueSlider = require('vue-slider-component') components['vue-slider'] = VueSlider }
and all run, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants