這篇文章將為大家詳細講解有關(guān)使用Vue怎么動態(tài)生成表格的行和列,文章內(nèi)容質(zhì)量較高,因此小編分享給大家做個參考,希望大家閱讀完這篇文章后對相關(guān)知識有一定的了解。

具體的實現(xiàn)代碼如下:
<template> <div class="boxShadow"> <div > <el-table :data="tables" ref="multipleTable" tooltip-effect="dark" @selection-change='selectArInfo'> <el-table-column type="selection" width="45px"></el-table-column> <el-table-column label="序號" width="62px" type="index"> </el-table-column> <template v-for='(col) in tableData'> <el-table-column sortable :show-overflow-tooltip="true" :prop="col.dataItem" :label="col.dataName" :key="col.dataItem" width="124px"> </el-table-column> </template> <el-table-column label="操作" width="80" align="center"> <template slot-scope="scope"> <el-button size="mini" class="del-com" @click="delTabColOne()" ><i class="iconfont icon-shanchu"></i></el-button> </template> </el-table-column> </el-table> </div> </div> </template>
<script>
import '../../assets/css/commlist.css'
import '../../assets/css/commscoped.sass'
export default {
data () {
return {
tables: [{
xiaoxue: '福蘭',
chuzhong: '加芳',
gaozhong: '蒲廟',
daxue: '西安',
yanjiusheng: '西安',
shangban: '北京'
}, {
xiaoxue: '南坊',
chuzhong: '禮泉',
gaozhong: '禮泉',
daxue: '西安',
yanjiusheng: '西安',
shangban: '南坊'
}, {
xiaoxue: '馬山',
chuzhong: '加芳',
gaozhong: '蒲廟',
daxue: '西安',
yanjiusheng: '重慶',
shangban: '北京'
}],
tableData: [{
dataItem: 'xiaoxue',
dataName: '小學(xué)'
}, {
dataItem: 'chuzhong',
dataName: '初中'
}, {
dataItem: 'gaozhong',
dataName: '高中'
}, {
dataItem: 'daxue',
dataName: '大學(xué)'
}, {
dataItem: 'yanjiusheng',
dataName: '研究生'
}, {
dataItem: 'shangban',
dataName: '上班'
}]
}
},
methods: {
// 獲取表格選中時的數(shù)據(jù)
selectArInfo (val) {
this.selectArr = val
}
}
}
</script>關(guān)于使用Vue怎么動態(tài)生成表格的行和列就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學(xué)到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。
名稱欄目:使用Vue怎么動態(tài)生成表格的行和列-創(chuàng)新互聯(lián)
標題網(wǎng)址:http://chinadenli.net/article30/cejppo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站排名、網(wǎng)站營銷、企業(yè)建站、網(wǎng)站策劃、關(guān)鍵詞優(yōu)化、小程序開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容