这篇文章主要介绍了Vue 固定头 固定列 点击表头可排序的表格组件的相关资料,需要的朋友可以参考下
原理是将原本文来源gao@!dai!ma.com搞$$代^@码网*table的指定行,指定列clone一份放在其上
实现代码如下:
<div> <div id="divBox1"> <table id="tbTest1" cellpadding="0" cellspacing="0"> <tr> <th> {{item}}</th></tr><tr> <td style="overflow:hidden"> </td></tr></table></div></div> #divBox1{ overflow:auto; width:100%; font-size: 0.28rem; } #ofix1_div_left{ box-shadow: #dddddd 2px 0px 2px; width: 2rem; } table { table-layout : fixed; } table td, table th { width: 2rem; line-height: 1rem; height: 1rem; padding: 0; color: #999999; overflow: hidden; white-space: nowrap; /*vertical-align: middle;*/ } table th{ background: rgba(188,219,255,0.4); color: #999; font-size: .28rem; font-weight: normal; } table th:nth-child(1){ box-shadow: #dddddd 2px 0px 0px; } .ofix1_tb_left tr td:nth-child(1){ /*display: inline-block;*/ text-align: left; } #ofix1_div_top_left{ box-shadow: #dddddd 2px 0px 2px; } #tbTest1 tr td:nth-child(1){ box-shadow: #dddddd 2px 0px 0px; } #tbheader td { background: #fff; }
父组件调用实例:
import TableLocked from '../../common/TableLocked.vue' export default{ components: {TableLocked}, data () { data.gridColumns = ['brand', 'product_count', 'averagePrice', 'sales', 'huang_sale_per', 'sale_per', 'sales_amount', 'huang_sale_amount_per', 'sales_amount_per', 'score_num', 'scort_good_per'] data.thead = ['品类', '产品种类', '均价', '销量', '销量环比', '销量占比', '销额(万元)', '销额环比', '销额占比', '评论总数', '好评率'] } }
以上所述是小编给大家介绍的Vue 固定头 固定列 点击表头可排序的表格组件,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!
以上就是Vue 固定头 固定列 点击表头可排序的表格组件的详细内容,更多请关注gaodaima搞代码网其它相关文章!