forked from 75team-biz/vue-flow-grid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
98 lines (87 loc) · 2.09 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>vue-flow-grid</title>
<style>
* {
margin: 0;
padding: 0;
bottom: 0;
}
#app {
margin: 50px auto;
}
.grid-con > div > div {
margin: 10px;
}
.grid-con > div > div > div {
font-size: 26px;
text-align: center;
background-color: #808080;
color: #fff;
}
.btn {
display: inline-block;
background-color: salmon;
padding: 10px;
margin-bottom: 20px;
margin-left: 20px;
cursor: pointer;
border: none;
box-shadow: none;
color: #fff;
}
</style>
</head>
<body>
<div id="app" style="width: 1000px;">
<button class="btn" @click="increase">increase colunm</button>
<button class="btn" @click="decrease">decrease colunm</button>
<button class="btn" @click="add">add new grid</button>
<button class="btn" @click="remove">remove new grid</button>
<button class="btn" @click="reset">reset grids</button>
<div v-flow="colNum" class="grid-con">
<div v-for="(item, index) in grids">
<div :style="[{height: item + 'px'}, {'line-height': item + 'px'}]">
{{index}}
</div>
</div>
</div>
</div>
<script src="//lib.baomitu.com/vue/2.2.2/vue.js"></script>
<script src="./dist/index.js"></script>
<script>
const Vue = window.Vue;
Vue.use(window.FlowGrid);
const vm = new Vue({
el: '#app',
data() {
return {
colNum: 4,
grids: Array.from({ length: 8}, _ => 100 + 300 * Math.random())
};
},
methods: {
increase() {
this.colNum += 1;
},
decrease() {
if (this.colNum > 1) {
this.colNum -= 1;
}
},
add() {
this.grids.push(200 + 200 * Math.random());
},
remove() {
this.grids.pop();
},
reset() {
this.grids = Array.from({ length: 8 }, _ => 200 + 200 * Math.random());
}
}
});
</script>
</body>
</html>