Skip to content

Commit 13261df

Browse files
committed
basic working version
1 parent 6848f21 commit 13261df

File tree

3 files changed

+83
-6
lines changed

3 files changed

+83
-6
lines changed

README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,80 @@ vue-grid-layout is a grid layout system, like [Gridster](http://gridster.net), f
4343

4444
## Installation
4545

46+
Install the vue-grid-layout [package](https://www.npmjs.org/package/vue-grid-layout) package using [npm](https://www.npmjs.com/):
47+
48+
npm install react-grid-layout
4649

4750

4851
## Usage
4952

53+
npm install react-grid-layout
54+
55+
```javascript
56+
57+
var testLayout = [
58+
{"x":0,"y":0,"w":2,"h":2,"i":"0"},
59+
{"x":2,"y":0,"w":2,"h":4,"i":"1"},
60+
{"x":4,"y":0,"w":2,"h":5,"i":"2"},
61+
{"x":6,"y":0,"w":2,"h":3,"i":"3"},
62+
{"x":8,"y":0,"w":2,"h":3,"i":"4"},
63+
{"x":10,"y":0,"w":2,"h":3,"i":"5"},
64+
{"x":0,"y":5,"w":2,"h":5,"i":"6"},
65+
{"x":2,"y":5,"w":2,"h":5,"i":"7"},
66+
{"x":4,"y":5,"w":2,"h":5,"i":"8"},
67+
{"x":6,"y":4,"w":2,"h":4,"i":"9"},
68+
{"x":8,"y":4,"w":2,"h":4,"i":"10"},
69+
{"x":10,"y":4,"w":2,"h":4,"i":"11"},
70+
{"x":0,"y":10,"w":2,"h":5,"i":"12"},
71+
{"x":2,"y":10,"w":2,"h":5,"i":"13"},
72+
{"x":4,"y":8,"w":2,"h":4,"i":"14"},
73+
{"x":6,"y":8,"w":2,"h":4,"i":"15"},
74+
{"x":8,"y":10,"w":2,"h":5,"i":"16"},
75+
{"x":10,"y":4,"w":2,"h":2,"i":"17"},
76+
{"x":0,"y":9,"w":2,"h":3,"i":"18"},
77+
{"x":2,"y":6,"w":2,"h":2,"i":"19"}
78+
];
79+
80+
var GridLayout = VueGridLayout.GridLayout;
81+
var GridItem = VueGridLayout.GridItem;
82+
83+
new Vue({
84+
el: '#app',
85+
components: {
86+
GridLayout,
87+
GridItem,
88+
},
89+
data: {
90+
layout: testLayout,
91+
},
92+
});
93+
````
94+
95+
96+
````html
97+
98+
<grid-layout
99+
:layout.sync="layout"
100+
:col-num="12"
101+
:row-height="30"
102+
:is-draggable="true"
103+
:is-resizable="true"
104+
:vertical-compact="true"
105+
:margin="[10, 10]"
106+
:use-css-transforms="true"
107+
>
108+
109+
<grid-item v-for="item in layout"
110+
:x.sync="item.x"
111+
:y.sync="item.y"
112+
:w.sync="item.w"
113+
:h.sync="item.h"
114+
:i="item.i">
115+
{{item.i}}
116+
</grid-item>
117+
</grid-layout>
118+
````
119+
50120

51121
## Contribute
52122

index.html

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,24 @@ <h1>Vue Grid Layout</h1>
2626
<button @click="increaseWidth">Increase Width</button>
2727
<button @click="addItem">Add an item</button>
2828
<br/>
29-
<grid-layout :layout.sync="layout" :col-num="12" :row-height="30" :is-draggable="true" :is-resizable="true" :vertical-compact="true">
29+
<grid-layout
30+
:layout.sync="layout"
31+
:col-num="12"
32+
:row-height="30"
33+
:is-draggable="true"
34+
:is-resizable="true"
35+
:vertical-compact="true"
36+
:margin="[10, 10]"
37+
:use-css-transforms="true"
38+
>
39+
3040
<grid-item v-for="item in layout"
3141
:x.sync="item.x"
3242
:y.sync="item.y"
3343
:w.sync="item.w"
3444
:h.sync="item.h"
35-
:i="item.i"
36-
>
37-
<test-element :text="item.i"></test-element>
45+
:i="item.i">
46+
{{item.i}}
3847
</grid-item>
3948
</grid-layout>
4049
</div>

src/TestElement.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
<style>
77
</style>
88
<script>
9-
var Vue = require('vue');
10-
119
export default {
1210
name: "TestElement",
1311
props: {

0 commit comments

Comments
 (0)