我是靠谱客的博主 彩色夏天,这篇文章主要介绍ElementUI+VUE案例,demo,现在分享给大家,希望可以做个参考。

复制代码
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
<template> <div id="app" style="margin-top: 20px;" v-cloak> <el-col> <el-form ref="form" :model="form" label-width="100px" :inline="true"> <el-form-item label="阿啊实打实达"> <el-input v-model="form.md_typeName" size="mini" maxlength="20"></el-input> </el-form-item> <el-form-item label="发大股东非"> <el-input v-model="form.md_typeName" size="mini" maxlength="20"></el-input> </el-form-item> <el-button style="margin-left: 20px" type="primary" @click="search" icon="el-icon-search">查询</el-button> <el-button type="danger" @click="showAddDialog" icon="el-icon-plus">添加</el-button> </el-form> <el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange"> &lt;!&ndash; <el-table-column type="selection" ></el-table-column>&ndash;&gt; <el-table-column type="index"></el-table-column> <el-table-column prop="id" label="胜多负少的" show-overflow-tooltip> </el-table-column> <el-table-column prop="b" label="阿达" show-overflow-tooltip> </el-table-column> <el-table-column prop="c" label="胜多负少" show-overflow-tooltip> </el-table-column> <el-table-column prop="d" label="苟富贵" show-overflow-tooltip> </el-table-column> <el-table-column prop="e" label="二维" show-overflow-tooltip> </el-table-column> <el-table-column prop="f" label="操作" show-overflow-tooltip> <template slot-scope="scope"> <el-button type="primary" size="mini" @click="showEditDialog(scope.row.id)">编辑</el-button> <el-button type="warning" size="mini" @click="deleteInfo(scope.row.id)">删除</el-button> </template> </el-table-column> </el-table> <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[2, 4, 8, 10]" :page-size="2" layout="total, sizes, prev, pager, next, jumper" :total="total"></el-pagination> </el-col> <el-dialog title="修改" :visible.sync="EditdialogVisible" width="60%" > <el-form :model="eidtForm" :ref="eidtFormRef" label-width="70px" class="demo-ruleForm"> <el-form-item label="地方"> <el-input v-model="eidtForm.id"></el-input> </el-form-item> <el-form-item label="阿达"> <el-input v-model="eidtForm.b"></el-input> </el-form-item> <el-form-item label="地方"> <el-input v-model="eidtForm.c"></el-input> </el-form-item> <el-form-item label="胜多负少"> <el-input v-model="eidtForm.d"></el-input> </el-form-item> <el-form-item label="给对方" > <el-input v-model="eidtForm.e"></el-input> </el-form-item> <el-form-item label="二维"> <el-input v-model="eidtForm.f"></el-input> </el-form-item> </el-form> <span slot="footer" class="dialog-footer"> <el-button @click="EditCanel">取 消</el-button> <el-button type="primary" @click="EditInfo">确 定</el-button> </span> </el-dialog> <el-dialog title="添加" :visible.sync="AddDialogVisible" width="60%" > <el-form :model="addForm" :ref="addForm" label-width="70px" class="demo-ruleForm"> <el-form-item label="规划局"> <el-input v-model="addForm.id"></el-input> </el-form-item> <el-form-item label="都是废话"> <el-input v-model="addForm.b"></el-input> </el-form-item> <el-form-item label="关乎"> <el-input v-model="addForm.c"></el-input> </el-form-item> <el-form-item label="师范"> <el-input v-model="addForm.d"></el-input> </el-form-item> <el-form-item label="返回" > <el-input v-model="addForm.e"></el-input> </el-form-item> <el-form-item label="发过火"> <el-input v-model="addForm.f"></el-input> </el-form-item> </el-form> <span slot="footer" class="dialog-footer"> <el-button @click="AddCanel">取 消</el-button> <el-button type="primary" @click="addinfo">确 定</el-button> </span> </el-dialog> </div> </template> <script> export default { name: "index", data: function() { return { total: 3, showDiv: false, EditdialogVisible:false, AddDialogVisible:false, form: { md_typeId: '', md_typeName: '', md_ptName:'', pageSize: 2, pageIndex: 1 }, addForm:{}, eidtForm:{ id: '1111111', b: '王小虎', c: '上海市普陀区金沙江路 1518 弄', d:2, e:3, f:4 }, tableData: [{ id: '1111111', b: '王小虎', c: '上海市普陀区金沙江路 1518 弄', d:2, e:3, f:4 }, { id: '22222222', b: '王小虎', c: '上海市普陀区金沙江路 1518 弄', d:2, e:3, f:4 }, { id: '333333', b: '王小虎', c: '上海市普陀区金沙江路 1518 弄', d:2, e:3, f:4 }], multipleSelection: [], currentPage: 1, loading: false, message:'' } }, mounted: function() { //初始化 this.search(); }, methods: { handleSelectionChange: function(val) { this.multipleSelection = val; }, handleSizeChange: function(val) { this.form.pageSize = val; this.search(); }, handleCurrentChange: function(val) { this.form.pageIndex = val; this.search(); }, showEditDialog(id){ this.EditdialogVisible=true; getObj(id) .then(response => { this.eidtForm = response.data; }) }, EditCanel(eidtForm){ this.EditdialogVisible=false; this.$refs[eidtForm].resetFields(); }, EditInfo(){ //关闭对话框 之后写里面 this.EditdialogVisible=false; putObj(this.eidtForm.id,this.eidtForm) .then(response => { this.message = response.bodyText; //提示成功 this.$message({ showClose: true, message: this.message, type: 'success' }); // 刷新页面 this.search(); }) }, deleteInfo(id){ this.$confirm('此操作将永久删除, 是否继续?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { delObj(id) .then(() => { this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 }); }); }); }, showAddDialog(){ this.AddDialogVisible=true; }, addinfo(){ const set = this.$refs; set[addForm].validate(valid => { if (valid) { addObj(this.addForm) .then(() => { this.AddDialogVisible = false; this.getList(); this.$notify({ title: '成功', message: '创建成功', type: 'success', duration: 2000 }); }) } else { return false; } }); }, AddCanel(){ this.AddDialogVisible=false; this.$refs[addForm].resetFields(); }, search(){ var vm = this; vm.loading=true; vm.$http.post(path + '/soft_TypeList', encrypt(vm.form)).then(function(response) { var objData = decrypt(response.bodyText); vm.tableData = objData.result.list; /* vm.total = objData.result.total*/ vm.loading = false; }, function(response) { vm.loading = false; this.$message({ showClose: true, message: '获取信息查询失败', type: 'error' }); }); } } } </script> <style scoped> html{ background: #ffffff; } .el-form-item { margin-bottom: 10px; } .el-table th { background-color: #f0f0f0; } .el-table thead { color: #4f4f4f; } .el-pagination{ text-align: center; } </style>

 

最后

以上就是彩色夏天最近收集整理的关于ElementUI+VUE案例,demo的全部内容,更多相关ElementUI+VUE案例内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(80)

评论列表共有 0 条评论

立即
投稿
返回
顶部