Skip to content

Commit 6e443d8

Browse files
committed
Cleaned up README
1 parent 2361db4 commit 6e443d8

File tree

4 files changed

+28
-17
lines changed

4 files changed

+28
-17
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
### vue-js-grid
22

3-
Fixed size grid for Vue.js
3+
#### Fixed size grid for Vue.js
4+
5+
This is very a first version of the plugin. If you find any bugs and/or want to contribute, feel free to create issues, PRs or reach me out on twitter! 👍 🚀
6+
7+
Thanks!
48

59
### Install
610
```
@@ -20,8 +24,8 @@ Vue.use(Grid)
2024
data () {
2125
return {
2226
items: [
23-
'a',
24-
'b',
27+
'a',
28+
'b',
2529
'c'
2630
]
2731
}
@@ -35,7 +39,7 @@ data () {
3539
:height="100"
3640
:width="100">
3741
<template slot="cell" scope="props">
38-
<div>{{props.item.value}}</div>
42+
<div>{{props.item}}</div>
3943
</template>
4044
</grid>
4145
```

demo/src/App.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ export default {
7676
7777
methods: {
7878
click ({ items, index }) {
79-
let item = items.find(v => v.index === index)
80-
this.selected = item.color
79+
let color = items.find(v => v.index === index)
80+
this.selected = color
81+
82+
console.log(this.selected)
8183
},
8284
8385
change (event) {

demo/src/Icon.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
<div v-if="withButton"
44
class="icon-delete-btn"
55
@mousedown="remove"></div>
6-
<slot/>
6+
<slot>
7+
{{index}}
8+
</slot>
79
</div>
810
</template>
911

@@ -28,9 +30,8 @@ export default {
2830
computed: {
2931
brightness () {
3032
let { r, g, b } = this.color
31-
let brightness = 0.299 * r + 0.587 * g + 0.114 * b
3233
33-
return brightness
34+
return 0.299 * r + 0.587 * g + 0.114 * b
3435
},
3536
style () {
3637
if (this.color) {
@@ -81,7 +82,7 @@ export default {
8182
box-shadow: 0px 6px 20px rgba(0, 0, 0, 0.07);
8283
color: #777;
8384
84-
font-weight: 900;
85+
font-weight: 300;
8586
font-size: 12px;
8687
8788
line-height: 52px;

src/Grid.vue

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export default {
116116
/* Returns merged event object */
117117
wrapEvent (other = {}) {
118118
return {
119-
// datetime: Date.now(),
119+
datetime: Date.now(),
120120
items: this.getListClone(),
121121
...other
122122
}
@@ -128,9 +128,9 @@ export default {
128128
.sort((a, b) => {
129129
return a.sort - b.sort
130130
})
131-
.map(v => {
132-
return { ...v.item }
133-
})
131+
// .map(v => {
132+
// return { ...v.item }
133+
// })
134134
},
135135
136136
removeItem ({ index }) {
@@ -176,10 +176,14 @@ export default {
176176
let targetItem = this.list.find(item => item.index === itemIndex)
177177
let targetItemSort = targetItem.sort
178178
179-
// Normalizing new grid position
179+
/*
180+
Normalizing new grid position
181+
*/
180182
gridPosition = Math.max(gridPosition, 0)
181-
// If you remove this line you can drag items to positions that
182-
// are further than items array length
183+
/*
184+
If you remove this line you can drag items to positions that
185+
are further than items array length
186+
*/
183187
gridPosition = Math.min(gridPosition, this.list.length - 1)
184188
185189
if (targetItemSort !== gridPosition) {

0 commit comments

Comments
 (0)