Skip to content

Commit 1aa74ef

Browse files
authored
Merge pull request #2139 from adumesny/master
Vue demo cleanup
2 parents 8302cb5 + a8372f0 commit 1aa74ef

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

demo/vue2js.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>Gridstack.js Vue integration example</title>
6+
<title>Vue2 Gridstack</title>
77
<link rel="stylesheet" href="demo.css"/>
88
<script src="../dist/gridstack-all.js"></script>
99
</head>
@@ -26,7 +26,7 @@ <h1>How to integrate GridStack.js with Vue.js</h1>
2626
to let Vue deal with DOM rendering.
2727
</p>
2828
<button type="button" @click="addNewWidget()">Add Widget</button> {{ info }}
29-
<section class="grid-stack"></section>
29+
<div class="grid-stack"></div>
3030
</main>
3131
<script type="module">
3232
import Vue from "https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.esm.browser.js";

demo/vue3js.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>Gridstack.js Vue integration example</title>
6+
<title>Vue3 Gridstack</title>
77
<link rel="stylesheet" href="demo.css"/>
88
<script src="../dist/gridstack-all.js"></script>
99
</head>
@@ -26,7 +26,7 @@ <h1>How to integrate GridStack.js with Vue.js</h1>
2626
to let Vue deal with DOM rendering.
2727
</p>
2828
<button type="button" @click="addNewWidget()">Add Widget</button> {{ info }}
29-
<section class="grid-stack"></section>
29+
<div class="grid-stack"></div>
3030
</main>
3131
<script type="module">
3232
import { createApp, ref, onMounted } from "https://cdn.jsdelivr.net/npm/vue@3.0.11/dist/vue.esm-browser.js";
@@ -51,10 +51,8 @@ <h1>How to integrate GridStack.js with Vue.js</h1>
5151
minRow: 1,
5252
});
5353

54-
// Use an arrow function so that `this` is bound to the Vue instance. Alternatively, use a custom Vue directive on the `.grid-stack` container element: https://vuejs.org/v2/guide/custom-directive.html
55-
grid.on("dragstop", (event, element) => {
54+
grid.on("dragstop", function (event, element) {
5655
const node = element.gridstackNode;
57-
// `this` will only access your Vue instance if you used an arrow function, otherwise `this` binds to window scope. see https://hacks.mozilla.org/2015/06/es6-in-depth-arrow-functions/
5856
info.value = `you just dragged node #${node.id} to ${node.x},${node.y} – good job!`;
5957
});
6058
});

0 commit comments

Comments
 (0)