File tree Expand file tree Collapse file tree 4 files changed +28
-17
lines changed Expand file tree Collapse file tree 4 files changed +28
-17
lines changed Original file line number Diff line number Diff line change 1
1
### vue-js-grid
2
2
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!
4
8
5
9
### Install
6
10
```
@@ -20,8 +24,8 @@ Vue.use(Grid)
20
24
data () {
21
25
return {
22
26
items: [
23
- ' a' ,
24
- ' b' ,
27
+ ' a' ,
28
+ ' b' ,
25
29
' c'
26
30
]
27
31
}
@@ -35,7 +39,7 @@ data () {
35
39
: height= " 100"
36
40
: width= " 100" >
37
41
< template slot= " cell" scope= " props" >
38
- < div> {{props .item . value }}< / div>
42
+ < div> {{props .item }}< / div>
39
43
< / template>
40
44
< / grid>
41
45
` ` `
Original file line number Diff line number Diff line change @@ -76,8 +76,10 @@ export default {
76
76
77
77
methods: {
78
78
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 )
81
83
},
82
84
83
85
change (event ) {
Original file line number Diff line number Diff line change 3
3
<div v-if =" withButton"
4
4
class =" icon-delete-btn"
5
5
@mousedown =" remove" ></div >
6
- <slot />
6
+ <slot >
7
+ {{index}}
8
+ </slot >
7
9
</div >
8
10
</template >
9
11
@@ -28,9 +30,8 @@ export default {
28
30
computed: {
29
31
brightness () {
30
32
let { r, g, b } = this .color
31
- let brightness = 0.299 * r + 0.587 * g + 0.114 * b
32
33
33
- return brightness
34
+ return 0.299 * r + 0.587 * g + 0.114 * b
34
35
},
35
36
style () {
36
37
if (this .color ) {
@@ -81,7 +82,7 @@ export default {
81
82
box-shadow : 0px 6px 20px rgba (0 , 0 , 0 , 0.07 );
82
83
color : #777 ;
83
84
84
- font-weight : 900 ;
85
+ font-weight : 300 ;
85
86
font-size : 12px ;
86
87
87
88
line-height : 52px ;
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ export default {
116
116
/* Returns merged event object */
117
117
wrapEvent (other = {}) {
118
118
return {
119
- // datetime: Date.now(),
119
+ datetime: Date .now (),
120
120
items: this .getListClone (),
121
121
... other
122
122
}
@@ -128,9 +128,9 @@ export default {
128
128
.sort ((a , b ) => {
129
129
return a .sort - b .sort
130
130
})
131
- .map (v => {
132
- return { ... v .item }
133
- })
131
+ // .map(v => {
132
+ // return { ...v.item }
133
+ // })
134
134
},
135
135
136
136
removeItem ({ index }) {
@@ -176,10 +176,14 @@ export default {
176
176
let targetItem = this .list .find (item => item .index === itemIndex)
177
177
let targetItemSort = targetItem .sort
178
178
179
- // Normalizing new grid position
179
+ /*
180
+ Normalizing new grid position
181
+ */
180
182
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
+ */
183
187
gridPosition = Math .min (gridPosition, this .list .length - 1 )
184
188
185
189
if (targetItemSort !== gridPosition) {
You can’t perform that action at this time.
0 commit comments