使用vue+element-ui+ajax这几样技术,实现一个表格的实例
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了使用vue+element-ui+ajax这几样技术,实现一个表格的实例,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2541字,纯文字阅读大概需要4分钟。
内容图文
![使用vue+element-ui+ajax这几样技术,实现一个表格的实例](/upload/InfoBanner/zyjiaocheng/289/6147ecd969194527a2913e17b406fb3d.jpg)
实例如下:
<!DOCTYPE html> <html> <head> <script src="js/jquery-3.2.1.js"></script> <script src="vue.js"></script> <!-- 引入样式 --> <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css" rel="external nofollow" > <!-- 引入组件库 --> <script src="https://unpkg.com/element-ui/lib/index.js"></script> </head> <body> <p id="app"> <template> <el-table :data="tableData" style="width: 100%"> <el-table-column label="任务" width="180"> <template slot-scope="scope"> <el-popover trigger="hover" placement="top"> <p>姓名: {{ scope.row.name }}</p> <p slot="reference" class="name-wrapper"> <el-tag size="medium">{{ scope.row.name }}</el-tag> </p> </el-popover> </template> </el-table-column> <el-table-column label="历时" width="180"> <template slot-scope="scope"> <i class="el-icon-time"></i> <span style="margin-left: 10px">{{ scope.row.take }}</span> </template> </el-table-column> <el-table-column label="开始时间" width="180"> <template slot-scope="scope"> <i class="el-icon-time"></i> <span style="margin-left: 10px">{{ scope.row.startTime }}</span> </template> </el-table-column> <el-table-column label="结束时间" width="180"> <template slot-scope="scope"> <i class="el-icon-time"></i> <span style="margin-left: 10px">{{ scope.row.finishTime }}</span> </template> </el-table-column> <el-table-column label="操作"> <template slot-scope="scope"> <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button> <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button> </template> </el-table-column> </el-table> </template> </p> <script type="text/javascript"> new Vue({ el:'#app', data:{ tableData: [], getUrl: 'http://localhost:8080/mytime/getTodayTomatos', }, created: function(){ this.getTableData() }, methods:{ getTableData:function(){ var self = this; $.ajax({ type : "post", dataType : "json", contentType : "application/json", url : "http://localhost:8080/mytime/getTodayTomatos", success : function(json) { self.tableData=json.fitomatos; }, error : function(json) { alert("加载失败"); } }); }, handleEdit(index, row) { console.log(index, row.name); }, handleDelete(index, row) { console.log(index, row); } } }) </script> </body> </html>
效果图:
上面是我整理给大家的,希望今后会对大家有帮助。
相关文章:
javascript原生封装一个淡入淡出效果的函数测试实例代码
react-native-video实现视频全屏播放的方法
vue实现树形菜单效果
以上就是使用vue+element-ui+ajax这几样技术,实现一个表格的实例的详细内容,更多请关注Gxl网其它相关文章!
内容总结
以上是互联网集市为您收集整理的使用vue+element-ui+ajax这几样技术,实现一个表格的实例全部内容,希望文章能够帮你解决使用vue+element-ui+ajax这几样技术,实现一个表格的实例所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。