<template> <div> <el-table :data="resultTable" border ref="multipleTable" tooltip-effect="light" size="mini"> <el-table-column type="index" label="序号" width="50" align="center"></el-table-column> <el-table-column v-for="(key,index) in Object.keys(resultTable[0])" :key="Math.random(index)" :label="key" :prop="key" align="center" show-overflow-tooltip> </el-table-column> </el-table> </div> </template> <script> export default { data(){ return{ resultTable:[ { "param1":5, "param2":31, "param3":115, "param4":115.1, "param5":115.2 },{ "param1":5.1, "param2":31.1, "param3":115.1, "param4":115.2, "param5":115.3 },{ "param1":5.1, "param2":31.1, "param3":115.1, "param4":115.2, "param5":115.3 },{ "param1":5.1, "param2":31.1, "param3":115.1, "param4":115.2, "param5":115.3 },{ "param1":5.1, "param2":31.1, "param3":115.1, "param4":115.2, "param5":115.3 },{ "param1":5.1, "param2":31.1, "param3":115.1, "param4":115.2, "param5":115.3 },{ "param1":5.1, "param2":31.1, "param3":115.1, "param4":115.2, "param5":115.3 } ] } }, } </script>
到此这篇ElementUI el-table遍历实现表格的自定义列【key值为列名】的文章就介绍到这了,更多相关内容请继续浏览下面的相关推荐文章,希望大家都能在编程的领域有一番成就!
版权声明:
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若内容造成侵权、违法违规、事实不符,请将相关资料发送至xkadmin@xkablog.com进行投诉反馈,一经查实,立即处理!
转载请注明出处,原文链接:https://www.xkablog.com/qdkf/11202.html