vue-drag-resize icon indicating copy to clipboard operation
vue-drag-resize copied to clipboard

window is not defined - nuxt.js ssr

Open RanjeetEppa18 opened this issue 3 years ago • 1 comments

image

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'

RanjeetEppa18 avatar Jun 07 '21 13:06 RanjeetEppa18

You need to precise mode: 'client' in your nuxt.config


Please try these steps to make it work:

  1. 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)
  1. then in your nuxt.config, in your plugins definition
{
    src: '~plugins/draggable',
    mode: 'client',
},

should be OK 😉

aurhell avatar Oct 25 '21 20:10 aurhell