Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ grid.printCount();

search for ['gridstack' under NPM](https://www.npmjs.com/search?q=gridstack&ranking=popularity) for latest, more to come...

- vue.js: see [demo](https://github.com/gridstack/gridstack.js/blob/develop/demo/vuejs.html)
- ember: [ember-gridstack](https://github.com/yahoo/ember-gridstack)
- AngularJS: [gridstack-angular](https://github.com/kdietrich/gridstack-angular)
- Angular8: [lb-gridstack](https://github.com/pfms84/lb-gridstack)
Expand Down
1 change: 1 addition & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ <h1>Demos</h1>
<li><a href="right-to-left(rtl).html">Right-To-Left (RTL)</a></li>
<li><a href="serialization.html">Serialization</a></li>
<li><a href="two.html">Two grids</a></li>
<li><a href="vuejs.html">Vue.js</a></li>
</ul>
</body>
</html>
9 changes: 4 additions & 5 deletions demo/vuejs.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ <h1>How to integrate GridStack.js with Vue.js</h1>
>
to let Vue deal with DOM rendering.
</p>
<p>{{ info }}</p>
<button type="button" @click="addNewWidget()">Add Widget</button>
<button type="button" @click="addNewWidget()">Add Widget</button> {{ info }}
<section class="grid-stack"></section>
</main>
<script type="module">
Expand Down Expand Up @@ -77,13 +76,13 @@ <h1>How to integrate GridStack.js with Vue.js</h1>
},
mounted: function () {
// Provides access to the GridStack instance across the Vue component.
this.grid = GridStack.init({ float: true });
this.grid = GridStack.init({ float: true, cellHeight: '70px', minRow: 1 });

// 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
this.grid.on("dragstop", (event, element) => {
const node = event.target.gridstackNode;
const node = element.gridstackNode;
// `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/
this.info = `You just dragged node #${node.id} to x${node.x} y${node.y} – good job!`;
this.info = `you just dragged node #${node.id} to ${node.x},${node.y} – good job!`;
});
},
methods: {
Expand Down