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

Use with Gridsome / SSR #27

Open
davestewart opened this issue Nov 12, 2019 · 0 comments
Open

Use with Gridsome / SSR #27

davestewart opened this issue Nov 12, 2019 · 0 comments

Comments

@davestewart
Copy link

davestewart commented Nov 12, 2019

Hello,

Gridsome bails when using this plugin, as window is not available:

ReferenceError: window is not defined
    at Object.<anonymous> (node_modules/vue-sticky/dist/vue-sticky.js:1:198)
    at __webpack_require__ (webpack/bootstrap:25:0)
    at Module.<anonymous> (assets/js/app.1a437b52.js:7771:18)
    at __webpack_require__ (webpack/bootstrap:25:0)
    at Module.<anonymous> (node_modules/gridsome/app/main.js:4:9)
    at __webpack_require__ (webpack/bootstrap:25:0)
    at Object.module.exports.module.exports (assets/js/app.1a437b52.js:2918:18)
    at __webpack_require__ (webpack/bootstrap:25:0)
    at assets/js/app.1a437b52.js:118:18
    at Object.<anonymous> (assets/js/app.1a437b52.js:121:10)

I tried the following, but no luck:

v-sticky="{ stickyTop: 40, disabled: process.isServer }"

I thought this would make it work, but it doesn't:

const unwatch = () => {
  window && window.removeEventListener('scroll', listenAction)
}
const watch = () => {
  window && window.addEventListener('scroll', listenAction)
}

Have you tested with SSR yet?

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

1 participant