jpopup
jpopup copied to clipboard
document is not defined
I tried including this in a Nuxt (vue.js) project, that has server side rendering, with this basic example:
<template>
<div>
<h1>Hi World</h1>
</div>
</template>
<script>
import jPopup from 'jPopup';
export default {
data () {
return {
popup: null
}
},
mounted () {
// eslint-disable-next-line new-cap
this.popup = new jPopup({ // initialize jPopup
content: '<p>Lorem Ipsum...</p>',
transition: 'fade',
onOpen: ($popupElement) => {
console.log('popup open');
},
onClose: ($popupElement) => {
console.log('popup closed');
}
});
this.popup.open();
}
}
</script>
<style lang="scss" scoped>
</style>
However, it will crash the whole app:
document is not defined
@simplenotezy Hi, not sure what could be the cause of that, there are just couple of standard JS selectors in the code (e.g. document.querySelector('html'))