欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue+elementui實(shí)現(xiàn)表格多級(jí)表頭效果

 更新時(shí)間:2022年04月13日 10:04:40   作者:不要停止努力呦  
這篇文章主要為大家詳細(xì)介紹了vue?+?elementui實(shí)現(xiàn)表格多級(jí)表頭,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了vue+elementui實(shí)現(xiàn)表格多級(jí)表頭的具體代碼,供大家參考,具體內(nèi)容如下

table組件

<template>
? <div class="tableCon" id="tableCon">
? ? <el-table
? ? :data="dataSource"
? ? :height="tableHeight"
? ? v-loading="loading"
? ? show-overflow-tooltip
? ? ref="multipleTable"
? ? class="multipleTable"
? ? @selection-change="selectionCchange"
? ? :key="key">
? ? ? <!-- 表格多選框 -->
? ? ? <el-table-column
? ? ? ? v-if="selectShow"
? ? ? ? type="selection"
? ? ? ? align="center"
? ? ? ? >
? ? ? </el-table-column>
? ? ? <!-- 表格單選框 -->
? ? ? <el-table-column
? ? ? ? v-if="radioShow && !selectShow">
? ? ? ? <template slot-scope="scope">
? ? ? ? ? <el-radio v-model="radioVal" @change.native="getRow(scope.row)"></el-radio>
? ? ? ? </template>
? ? ? </el-table-column>
? ? ? <!-- 序號(hào)-自定義序號(hào)列 -->
? ? ? <el-table-column
? ? ? ? v-if="indexShow"
? ? ? ? type="index"
? ? ? ? align="center"
? ? ? ? label="序號(hào)"
? ? ? ? fixed="left"
? ? ? ? :width="indexWidth">
? ? ? ? ? <template slot-scope="scope">
? ? ? ? ? ? <span>{{(page - 1) * size + scope.$index + 1}}</span>
? ? ? ? ? </template>
? ? ? </el-table-column>
? ? ? <!-- 表格數(shù)據(jù)列 -->
? ? ? <el-table-column
? ? ? ? align="center"
? ? ? ? v-for="(cloumn,index) in tableCloumns"
? ? ? ? :key="index"
? ? ? ? :label="cloumn.title"
? ? ? ? :prop="cloumn.prop"
? ? ? ? :show-overflow-tooltip="cloumn.tooltipDisplay">
? ? ? ? <!-- 表格枚舉 -->
? ? ? ? <template slot-scope="scope">
? ? ? ? ? <span v-if="cloumn.prop==='status'">{{scope.row.status==='1'?'是':'否'}}</span>
? ? ? ? ? <span v-else>{{ scope.row[cloumn.prop]}}</span>
? ? ? ? </template>
? ? ? ? <!-- 二級(jí)表頭 -->
? ? ? ? <template ?v-for="(columnChildren,i) in cloumn.children">
? ? ? ? ? <el-table-column
? ? ? ? ? ? :key="i"
? ? ? ? ? ? :label="columnChildren.title"
? ? ? ? ? ? :prop="columnChildren.prop"
? ? ? ? ? ? :show-overflow-tooltip="columnChildren.tooltipDisplay"
? ? ? ? ? ? align="center">
? ? ? ? ? ? <template slot-scope="scope">
? ? ? ? ? ? ? <!-- 二級(jí)表頭枚舉 -->
? ? ? ? ? ? ? <span v-if="columnChildren.prop==='exit'">{{scope.row.exit==='1'?'是':'否'}}</span>
? ? ? ? ? ? ? <span v-else>{{scope.row[columnChildren.prop] || '--'}}</span>
? ? ? ? ? ? </template>
? ? ? ? ? </el-table-column>
? ? ? ? </template>
? ? ? </el-table-column>
? ? ? <!-- 操作列 -->
? ? ? <el-table-column
? ? ? ? v-if="tableOperaDisplay"
? ? ? ? :width="tableOperaWidth"
? ? ? ? label="操作"
? ? ? ? align="center"
? ? ? ? fixed="right">
? ? ? ? <template slot-scope="scope">
? ? ? ? ? <span
? ? ? ? ? ? class="font-small font-color-light operationSpan"
? ? ? ? ? ? v-if="detailOperaDisplay"
? ? ? ? ? ? @click="detailOperaHandle(scope.row)"
? ? ? ? ? ? >{{ tableOperationText1 }}
? ? ? ? ? ? </span>
? ? ? ? </template>
? ? ? </el-table-column>
? ? </el-table>
? </div>
</template>
<script>
import moment from 'moment'
export default {
? props:{
? ? dataSource:{//表格數(shù)據(jù)
? ? ? type:Array,
? ? ? default: () => ([])
? ? },
? ? loading:{
? ? ? type:Boolean,
? ? ? default:false
? ? },
? ? selectShow:{//表格多選框
? ? ? type:Boolean,
? ? ? default:false
? ? },
? ? radioShow:{//表格單選框
? ? ? type:Boolean,
? ? ? default:false
? ? },
? ? indexShow:{//序號(hào)列
? ? ? type:Boolean,
? ? ? default:false
? ? },
? ? page:{
? ? ? type:Number,
? ? ? default:1
? ? },
? ? ?size:{
? ? ? type:Number,
? ? ? default:10
? ? },
? ? indexWidth:{//序號(hào)列寬度
? ? ? type:String,
? ? ? default:'100'
? ? },
? ? tableCloumns:{//表格數(shù)據(jù)列
? ? ? type:Array,
? ? ? default: () => ([])
? ? },
? ? tableOperaDisplay:{//表格操作列
? ? ? type:Boolean,
? ? ? default:false
? ? },
? ? detailOperaDisplay:{//操作列詳情按鈕
? ? ? type:Boolean,
? ? ? default:false
? ? },
? ? tableOperationText1:{
? ? ? type:String,
? ? ? default:'詳情'
? ? }

? },
? mounted(){

? },
? data (){
? ? return {
? ? ? key:moment().format('YYYY-MM-DD HH:mm:ss'),
? ? ? tableHeight:'100%',
? ? ? radioVal:''
? ? }
? },
? methods: {
? ? detailOperaHandle (rowVal){
? ? ? // console.log(rowVal)
? ? ? this.$emit('detailOperaHandle',rowVal)
? ? },
? ? // 表格多選框事件
? ? selectionCchange (selectValArr){
? ? ? // console.log(selectValArr)
? ? ? this.$emit('selectValArr',selectValArr)

? ? },
? ? getRow (selectRowObj){
? ? ? console.log(selectRowObj)
? ? ? this.$emit('getRow',selectRowObj)
? ? }

? }

}
</script>
<style lang="scss" scoped>
#tableCon{
? height: 100%;
? .multipleTable{
? ? width: 100%;
? ? height: 100%;
? ? overflow: auto;
? }
}
</style>

在需要的頁(yè)面引入

<template>
? <div id="componentInfo">
? ? <div class="tableCon">
? ? ? <div class="tableArea">
? ? ? ? <tableModule
? ? ? ? :dataSource="tableDatas"
? ? ? ? :tableCloumns="cloumns"
? ? ? ? :loading="false"
? ? ? ? :indexShow="true"></tableModule>
? ? ? </div>
? ? </div>
? </div>
</template>
<script>
import tableModule from '@/components/public-tables'

export default {
? components:{
? ? tableModule
? },
? props:{

? },
? data (){
? ? return {
? ? ? tableDatas:[
? ? ? ? {name:'小花',sex:'女',age:'19',status:'1',school1:'1',school2:'2',exit:'1'},
? ? ? ? {name:'小朵',sex:'女',age:'19',status:'0',school1:'1',school2:'2',exit:'0'},
? ? ? ? {name:'小花朵',sex:'女',age:'19',status:'1',school1:'1',school2:'2',exit:'1'}],
? ? ? cloumns:[
? ? ? ? {
? ? ? ? ? title:'姓名',
? ? ? ? ? prop:'name'
? ? ? ? },
? ? ? ? {
? ? ? ? ? prop:'sex',
? ? ? ? ? title:'性別'
? ? ? ? },
? ? ? ? {
? ? ? ? ? prop:'age',
? ? ? ? ? title:'年齡'
? ? ? ? },
? ? ? ? {
? ? ? ? ? prop:'status',
? ? ? ? ? title:'是否在線'
? ? ? ? },
? ? ? ? {
? ? ? ? ? prop:'school',
? ? ? ? ? title:'學(xué)校',
? ? ? ? ? children:[
? ? ? ? ? ? {
? ? ? ? ? ? ? prop:'school1',
? ? ? ? ? ? ? title:'學(xué)校1'
? ? ? ? ? ? },
? ? ? ? ? ? {
? ? ? ? ? ? ? prop:'school2',
? ? ? ? ? ? ? title:'學(xué)校2'
? ? ? ? ? ? },
? ? ? ? ? ? {
? ? ? ? ? ? ? prop:'exit',
? ? ? ? ? ? ? title:'存在'
? ? ? ? ? ? }
? ? ? ? ? ]
? ? ? ? }
? ? ? ]
? ? }
? }
}
</script>
<style lang="scss" scoped>
#componentInfo{
? width: 100%;
? height: 100%;
? background-color: #fff;
? padding: 10px;
? .tableCon{
? ? width: 100%;
? ? height: 100%;
? ? .tableArea{
? ? ? width: 100%;
? ? ? height: 100%;
? ? }
? }
}
</style>

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Vue數(shù)據(jù)綁定簡(jiǎn)析小結(jié)

    Vue數(shù)據(jù)綁定簡(jiǎn)析小結(jié)

    這篇文章主要介紹了Vue數(shù)據(jù)綁定簡(jiǎn)析小結(jié),本文將從源碼的角度來對(duì)Vue響應(yīng)式數(shù)據(jù)中的觀察者模式進(jìn)行簡(jiǎn)析。小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2019-05-05
  • vue proxy 的優(yōu)勢(shì)與使用場(chǎng)景實(shí)現(xiàn)

    vue proxy 的優(yōu)勢(shì)與使用場(chǎng)景實(shí)現(xiàn)

    這篇文章主要介紹了vue proxy 的優(yōu)勢(shì)與使用場(chǎng)景實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-06-06
  • 何時(shí)/使用 Vue3 render 函數(shù)的教程詳解

    何時(shí)/使用 Vue3 render 函數(shù)的教程詳解

    這篇文章主要介紹了何時(shí)/使用 Vue3 render 函數(shù)的教程詳解,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-07-07
  • 解析如何自動(dòng)化生成vue組件文檔

    解析如何自動(dòng)化生成vue組件文檔

    在我們的印象使用中,vue除了寫業(yè)務(wù)代碼沒有特別新奇的功能了,今天就來看看如何自動(dòng)化生成vue組件文檔
    2021-06-06
  • vue中注冊(cè)自定義的全局js方法

    vue中注冊(cè)自定義的全局js方法

    這篇文章主要介紹了vue中注冊(cè)自定義的全局js方法,文中給大家補(bǔ)充介紹了vue自定義函數(shù)掛到全局的方法,需要的朋友可以參考下
    2019-11-11
  • 重新認(rèn)識(shí)vue之事件阻止冒泡的實(shí)現(xiàn)

    重新認(rèn)識(shí)vue之事件阻止冒泡的實(shí)現(xiàn)

    這篇文章主要介紹了重新認(rèn)識(shí)vue之事件阻止冒泡的實(shí)現(xiàn),小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2018-08-08
  • Vue Element UI + OSS實(shí)現(xiàn)上傳文件功能

    Vue Element UI + OSS實(shí)現(xiàn)上傳文件功能

    這篇文章主要為大家詳細(xì)介紹了Vue Element UI + OSS實(shí)現(xiàn)上傳文件功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2019-07-07
  • element-ui 上傳圖片后清空?qǐng)D片顯示的實(shí)例

    element-ui 上傳圖片后清空?qǐng)D片顯示的實(shí)例

    今天小編就為大家分享一篇element-ui 上傳圖片后清空?qǐng)D片顯示的實(shí)例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2018-09-09
  • 基于vue2.x的電商圖片放大鏡插件的使用

    基于vue2.x的電商圖片放大鏡插件的使用

    本篇文章主要介紹了基于vue2.x的電商圖片放大鏡插件的使用,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2018-01-01
  • vue實(shí)現(xiàn)websocket客服聊天功能

    vue實(shí)現(xiàn)websocket客服聊天功能

    這篇文章主要為大家詳細(xì)介紹了vue實(shí)現(xiàn)websocket客服聊天功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-10-10

最新評(píng)論