vue-drag-resize
vue-drag-resize copied to clipboard
window is not defined - nuxt.js ssr
I tried with <client-only>
tag - didn't work
Also tried Vue.extend(VueDragResize)
- dint work
Following line causes issue
import VueDragResize from 'vue-drag-resize'
You need to precise mode: 'client'
in your nuxt.config
Please try these steps to make it work:
- create a plugin (mine is called
draggable
)
import Vue from 'vue'
import VueDragResize from 'vue-drag-resize'
// eslint-disable-next-line vue/component-definition-name-casing
Vue.component('vue-drag-resize', VueDragResize)
- then in your
nuxt.config
, in your plugins definition
{
src: '~plugins/draggable',
mode: 'client',
},
should be OK 😉