-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap排版生成器
158 lines (149 loc) · 4.76 KB
/
bootstrap排版生成器
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link href="https://unpkg.com/element-ui/lib/theme-chalk/index.css" rel="stylesheet">
<link href="http://raw.githack.com/sentsin/layui/master/dist/css/layui.css" rel="stylesheet">
<title>bootstrap排版工具</title>
<style>
* {
padding: 0;
margin: 0;
}
html,
body {
background-color: #494a5f;
width: 100%;
height: 100%;
position: relative;
}
li {
list-style: none;
}
#jsbox_http {
position: absolute;
top: 50%;
left: 50%;
width: 400px;
padding: 20px;
box-sizing: border-box;
transform: translate(-50%, -50%);
background-color: #f5f5f5;
border-radius: 5px;
}
#demo {
padding: 20px;
overflow: hidden;
}
#demo>div {
padding: 20px;
overflow: hidden;
}
#demo>div>span {
background-color: #6495ee;
height: 40px;
color: #f5f5f5;
line-height: 40px;
text-align: center;
}
</style>
</head>
<body>
<div id="app">
<div id="demo">
<div v-for="item in 12">
<span :class="classStr">{{item}}</span>
</div>
</div>
<div id="jsbox_http">
<h3 style="text-align: center;">bootstrap排版工具</h3>
<el-form label-width="15%">
<el-form-item label="框架名">
<el-select v-model="uiValue" style="width: 100%" @change="getClass" placeholder="请选择框架名称">
<el-option v-for="item in uiTypes" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="<768px">
<el-select v-model="phoneValue" style="width: 100%" @change="getClass" placeholder="请选择手机份数">
<el-option v-for="item in colOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="≥768px">
<el-select v-model="padValue" style="width: 100%" @change="getClass" placeholder="请选择平板份数">
<el-option v-for="item in colOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="≥992px">
<el-select v-model="smallValue" style="width: 100%" @change="getClass" placeholder="请选择小屏幕份数">
<el-option v-for="item in colOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="≥1200px">
<el-select v-model="bigValue" style="width: 100%" @change="getClass" placeholder="请选择大屏幕份数">
<el-option v-for="item in colOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-input clearable v-model="classStr" style="margin-bottom: 20px;"></el-input>
</el-form>
</div>
</div>
</body>
<script src="https://cdn.bootcss.com/vue/2.5.17-beta.0/vue.min.js"></script>
<script src="https://unpkg.com/[email protected]/lib/index.js"></script>
<script>
var all = new Vue({
el: "#app",data: {uiTypes: [{value: "bootstrap",label: "bootstrap"}, {value: "layui",label: "layui"}],uiValue:"bootstrap",colOptions: [{value: "1",label: "1格"}, {value: "2",label: "2格"}, {value: "3",label: "3格"}, {
value: "4",
label: "4格"
}, {
value: "6",
label: "6格"
}, {
value: "7",
label: "7格"
}, {
value: "8",
label: "8格"
}, {
value: "9",
label: "9格"
}, {
value: "10",
label: "10格"
}, {
value: "11",
label: "11格"
}, {
value: "12",
label: "12格"
}],
phoneValue: 1,
padValue: 1,
smallValue: 1,
bigValue:1,
classStr: ""
},
created: function () {
var that = this;
that.getClass()
},
methods: {
getClass: function () {
const that = this;
let classStr ="";
if(that.uiValue=="bootstrap"){
classStr =
`col-xs-${that.phoneValue} col-sm-${that.padValue} col-md-${that.smallValue} col-lg-${that.bigValue}`;
}else{
classStr =
`layui-col-xs${that.phoneValue} layui-col-sm${that.padValue} layui-col-md${that.smallValue} layui-col-lg${that.bigValue}`;
}
that.classStr = classStr;
}
},
});
</script>
</html>