Vue中table表头合并的用法

<div class="panel-container">
    <div>
        <table class="table-head" width="80%">
            <thead>
                <tr>
                    <th class="headerTable" rowspan="2">名称</th>
                    <th rowspan="2">性别</th>
                    <th colspan="2">回来时间</th>
                    <th colspan="2">出去时间</th>
                </tr>
                <tr class="num">
                    <th>准时度</th>
                    <th>准时率</th>
                    <th>准时度</th>
                    <th>准时率</th>
                </tr>
            </thead>
        </table>
    </div>
    <div class="timeBody">
        <table>
            <tbody>
                <tr v-for="(item, index) in list" :key="index">
                    <td :title="item.name">{{item.name}}</td>
                    <td>{{item.sex}}</td>
                    <td>{{item.outTotal}}</td>
                    <td>{{item.outPer}}</td>
                    <td>{{item.inTotal}}</td>
                    <td>{{item.inPer}}</td>
                </tr>
            </tbody>
        </table>
    </div>
</div>
<script>
    export default {
        data() {
            return {
                list: [{
                    name: ‘地名1‘,
                    result: ‘1‘,
                    outTotal: ‘12‘,
                    outPer: ‘30%‘,
                    inTotal: ‘16‘,
                    inPer: ‘34%‘
                },{
                    name: ‘地名2‘,
                    result: ‘1‘
                    outTotal: ‘12‘,
                    outPer: ‘30%‘,
                    inTotal: ‘16‘,
                    inPer: ‘34%‘
                },{
                    name: ‘地名3‘,
                    result: ‘0‘,
                    outTotal: ‘12‘,
                    outPer: ‘30%‘,
                    inTotal: ‘16‘,
                    inPer: ‘34%‘
                }]
            }
        }
    }
</script>

原文地址:https://www.cnblogs.com/minozMin/p/9790084.html

时间: 2024-08-30 18:07:12

Vue中table表头合并的用法的相关文章

vue中computed和watch的用法

computed用来监控自己定义的变量,该变量不在data里面声明,直接在computed里面定义,然后就可以在页面上进行双向数据绑定展示出结果或者用作其他处理: computed比较适合对多个变量或者对象进行处理后返回一个结果值,也就是数多个变量中的某一个值发生了变化则我们监控的这个值也就会发生变化,举例:购物车里面的商品列表和总金额之间的关系,只要商品列表里面的商品数量发生变化,或减少或增多或删除商品,总金额都应该发生变化.这里的这个总金额使用computed属性来进行计算是最好的选择 wa

element-ui中table渲染的快速用法

element-ui中对table数据的渲染有一些模板式的操作,基本按照模板渲染数据即可 基本模板样式如下 <el-table :data="studentData.rows" style="width: 100%" stripe :header-cell-style="{background:'#e1e4eb'}" > <el-table-column prop="studentName" label=&q

Vue中Computed和Watch的用法及区别

一. 计算属性(computed) 1.计算属性是为了模板中的表达式简洁,易维护,符合用于简单运算的设计初衷. 例如: <p id="app"> {{ myname.substring(0,1).toUpperCase() + myname.substring(1) }} </p> 运算过于复杂,冗长,且不好维护,因此我们对于复杂的运算应该 使用计算属性的方式去书写. 因此可改写为: <body> <div id="app"

Vue中jsx的最简单用法

最终页面显示效果为 <div class="open-service" style="color: #0199f0; cursor: pointer;"> hello <p>world</p> </div> 主页面 parent.vue <template> <div class="hello"> <vue-test :typeSpan="typeSpan&q

vue中style的用法

最近学习了vue中class和class的用法,想来总结一下,也把我的知识提供给大家使用:首先来总结class的用法,vue中的class有4种写法;class和style都属于DOM属性,所以在vue中都用:class和:style表示 同样给id为box的div加上字体和颜色和背景颜色 方法一 <div id="box"> <strong :style="{color:'red',background:'blue'}">落入凡尘伤情着我&

vue中 表头 th 合并单元格,且表格列数不定的动态渲染方法

吐槽 今天,在vue中遇到 复杂表格的渲染 ,需要合并表头th的单元格,且合并单元格的那列的表头数据是动态数据,也就是不知道会有多少个表头列,而这几个表头列还分了好几个子表头. 这个需求在js里用Juicer模板很好做的,思路我是有的,但就是对于vue,我也算初学者,很多概念不是很懂,这就限制了思路. 在网上搜了很多合并单元格的都是简单的数据合并,也就是td合并, 不是我们的需求,就不贴了. 哎,废话不多说了,看代码吧: 代码示例 使用iviewui的table组件: 最初,直接使用项目中的iv

----Vue 中mixin 的用法详解----

说下我对vue中mixin的一点理解 vue中提供了一种混合机制--mixins,用来更高效的实现组件内容的复用.最开始我一度认为这个和组件好像没啥区别..后来发现错了.下面我们来看看mixins和普通情况下引入组件有什么区别? 组件在引用之后相当于在父组件内开辟了一块单独的空间,来根据父组件props过来的值进行相应的操作,单本质上两者还是泾渭分明,相对独立. 而mixins则是在引入组件之后,则是将组件内部的内容如data等方法.method等属性与父组件相应内容进行合并.相当于在引入后,父

table中的边框合并实例

<html><head><style type="text/css">table,th,td{border:1px solid blue;border-collapse:collapse;}</style></head> <body><table><tr><th>Firstname</th><th>Lastname</th></tr>

vue中watch的详细用法

在vue中,使用watch来响应数据的变化.watch的用法大致有三种.下面代码是watch的一种简单的用法: <input type="text" v-model="cityName"/> new Vue({ el: '#root', data: { cityName: 'shanghai' }, watch: { cityName(newName, oldName) { // ... } } }) 直接写一个监听处理函数,当每次监听到 cityNam