使用elementUI豎向表格、和并列的實(shí)現(xiàn)方法-創(chuàng)新互聯(lián)

這篇文章運(yùn)用簡(jiǎn)單易懂的例子給大家介紹使用elementUI豎向表格、和并列的實(shí)現(xiàn)方法,內(nèi)容非常詳細(xì),感興趣的小伙伴們可以參考借鑒,希望對(duì)大家能有所幫助。

目前成都創(chuàng)新互聯(lián)已為上千的企業(yè)提供了網(wǎng)站建設(shè)、域名、網(wǎng)絡(luò)空間、網(wǎng)站托管、企業(yè)網(wǎng)站設(shè)計(jì)、昌圖網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長(zhǎng),共同發(fā)展。

效果圖如下

使用elementUI豎向表格、和并列的實(shí)現(xiàn)方法

代碼

<template>
 <div>
  <section>
  <el-table
   :show-header="false"
   :data="tableData"
   :span-method="objectSpanMethod"
   border
   :cell-
   
  >
   <el-table-column prop="id" label="ID" width="240">
   <template slot-scope="scope">
    <div>
    <img :src="scope.row.id|setPicUrl" />
    </div>
   </template>
   </el-table-column>
   <el-table-column width="180" prop="name"></el-table-column>
   <el-table-column prop="amount1"></el-table-column>
   <el-table-column width="180" prop="amount2"></el-table-column>
   <el-table-column prop="amount3"></el-table-column>
  </el-table>
  </section>
 </div>
</template>
<script>
export default {
 name: "mallMember-detail",
 data() {
 return {
 //請(qǐng)求回來的數(shù)據(jù)
  dataForm: {},
 };
 },
 computed: {
 //因?yàn)閿?shù)據(jù)用到了dataform中的數(shù)據(jù),所以寫在了computed中
 tableData() {
  return [
  {
   id: this.dataForm.headImg,
   name: "用戶ID",
   amount1: this.dataForm.id,
   amount2: "注冊(cè)時(shí)間",
   amount3: this.dataForm.createDate
  },
  {
   id: this.dataForm.headImg,
   name: "微信昵稱",
   amount1: this.dataForm.nickName,
   amount2: "手機(jī)號(hào)碼",
   amount3: this.dataForm.phone
  },
  {
   id: this.dataForm.headImg,
   name: "會(huì)員名稱",
   amount1: this.dataForm.gradeName,
   amount2: "會(huì)員等級(jí)",
   amount3: this.dataForm.gradeCode
  },
  {
   id: this.dataForm.headImg,
   name: "用戶來源",
   amount1: this.dataForm.channel,
   amount2: "常住地",
   amount3:
   this.dataForm.provinceName +
   this.dataForm.cityName +
   this.dataForm.districtName
  }
  ];
 }
 },
 methods: {
 // 自定義列背景色
 columnStyle({ row, column, rowIndex, columnIndex }) {
  if (columnIndex == 0 || columnIndex == 1 || columnIndex == 3) {
  //第三第四列的背景色就改變了2和3都是列數(shù)的下標(biāo)
  return "background:#f3f6fc;";
  }else{
  return "background:#ffffff;";
  }
 },
 // 和并列
 objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  if (columnIndex === 0) {
  if (rowIndex % 4 === 0) {
   return {
   rowspan: 4,
   colspan: 1
   };
  } else {
   return {
   rowspan: 0,
   colspan: 0
   };
  }
  }
 },
 }
};
</script>

新聞標(biāo)題:使用elementUI豎向表格、和并列的實(shí)現(xiàn)方法-創(chuàng)新互聯(lián)
標(biāo)題來源:http://muchs.cn/article0/ddcjoo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)公司、動(dòng)態(tài)網(wǎng)站、搜索引擎優(yōu)化網(wǎng)站設(shè)計(jì)、靜態(tài)網(wǎng)站、網(wǎng)站維護(hù)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站建設(shè)