Use with nuxt
See original GitHub issueI install this package and:
<template>
<no-ssr>
<div style="height: 500px; width: 500px; border: 1px solid red; position: relative;">
<vue-draggable-resizable :w="100" :h="100" v-on:dragging="onDrag" v-on:resizing="onResize" :parent="true">
<p>Hello! I'm a flexible component. You can drag me around and you can resize me.<br>
X: {{ x }} / Y: {{ y }} - Width: {{ width }} / Height: {{ height }}</p>
</vue-draggable-resizable>
</div>
</no-ssr>
</template>
<script>
import VueDraggableResizable from 'vue-draggable-resizable'
export default {
components: {
VueDraggableResizable,
},
data () {
return {
width: 0,
height: 0,
x: 0,
y: 0,
}
},
methods: {
onResize: function (x, y, width, height) {
this.x = x
this.y = y
this.width = width
this.height = height
},
onDrag: function (x, y) {
this.x = x
this.y = y
},
},
}
</script>
First reload of my page:
Second reload:
How can i use this package with nuxt? Tell me please.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:16 (4 by maintainers)
Top Results From Across the Web
Nuxt - The Intuitive Vue Framework
Build your next Vue.js application with confidence using Nuxt. An open source framework making web development simple and powerful.
Read more >Built-in Components - Nuxt
The <Nuxt> component is the component you use to display your page ... This component is used for displaying the children components in...
Read more >Installation - Nuxt
Another way to get started with Nuxt is to use CodeSandbox which is a great way for quickly playing around with Nuxt and/or...
Read more >Plugins directory - Nuxt
This is the place to add Vue plugins and to inject functions or constants. Every time you need to use Vue.use() , you...
Read more >Commands and Deployment - Nuxt
Commands and deployment. Nuxt comes with a set of useful commands, both for development and production purpose. Using in package.json.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry for the delay @nicothin. I made a PR to your repository fixing what I thought to be the problem. Check it out and let me know.
@askhat actually this is not a plugin, but a component. Therefore it needs to be registered inside Vue by using the
Vue.component('my-component-name', { ... })
notation.@nicothin Nuxt provides an ability to plug in JS code that specifically relies on browser runtime with plugins functionality.
Shortly, you have to create a file inside the
plugins
directory, and call it for examplevue-draggable-resizable.js
. Then you need to populate it with imports and using:After file is made, all you have to is register plugin, you also have an option to forbid SSR for this plugin. Inside
nuxt.config.js
:This is it, just make sure you do not use plugin in server side stages of component lifecycle.