最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Vue+Element自定義縱向表格表頭教程

 更新時(shí)間:2020年10月26日 11:38:18   作者:胖子ღ牛逼  
這篇文章主要介紹了Vue+Element自定義縱向表格表頭教程,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧

如下所示:

代碼如下:

<table style="width: 100%" class="myTable">
 <tr v-for="(item,i) in statDatas" :key="i">
 <td class="column">{{ item.key }}</td>
 <td class="column">{{ item.value }}</td>
 </tr>
</table>

綁定的是 statDatas 屬性是一個(gè) json數(shù)組,由key value組成的json,如果需要多列就直接增加屬性就可以。

優(yōu)美樣式:

.myTable {
 border-collapse: collapse;
 margin: 0 auto;
 text-align: center;
}
 
.myTable td,
.myTable th {
 border: 1px solid #cad9ea;
 color: #666;
 height: 60px;
}

補(bǔ)充知識(shí):vue element table表頭垂直表格(新增封裝一個(gè)垂直表格的組件)

對(duì)話框中彈出查看信息,打開(kāi)時(shí)表格,要求是表頭在左側(cè)

 <table class="tableInfo" :model="editForm" id="printTest">
   <thead></thead>
   <tbody>
    <tr>
    <td>日?qǐng)?bào)類(lèi)型</td>
    <td>{{editForm.daily_type | filterType}}</td>
    </tr>
    <tr>
    <td>開(kāi)始時(shí)間</td>
    <td>{{editForm.start_time | formatTimer('hours')}}</td>
    </tr>
    <tr>
    <td>結(jié)束時(shí)間</td>
    <td>{{editForm.end_time | formatTimer('hours') }}</td>
    </tr>
    <tr>
    <td>今日內(nèi)容</td>
    <td>{{editForm.content}}</td>
    </tr>
    <tr>
    <td>計(jì)劃</td>
    <td>{{editForm.plan}}</td>
    </tr>
   </tbody>
   </table>

效果

------------------手動(dòng)的華麗麗的的分割線------------------

最近封裝了一個(gè)帶插槽的垂直表頭的table組件

效果如圖

封裝的部分全部代碼

<template>
 <div class="table_detail">
 <div class="list" v-for="item in detailData" :key="item.value">
  <div class="label">
  <el-badge
   :value="1"
   class="item"
   type="primary"
   v-if="item.label === '扣分項(xiàng)' || item.label === '加分項(xiàng)'" //這里是動(dòng)態(tài)傳表頭進(jìn)去
  />
  {{ item.label }}
  </div>
  <div class="text">
  <template v-if="$scopedSlots[item.prop]">
   <slot :name="item.prop" :files="item.text"></slot>
  </template>
  <template v-else>{{ item.text }}</template>
  </div>
 </div>
 </div>
</template>
<script>
export default {
 name: "table-detail",
 props: {
 detailData: {
  type: Array,
  default: () => []
 }
 },
 data() {
 return {
  visible: false
 }
 }
}
</script>
<style lang="scss">
.table_detail {
 width: auto;
 height: auto;
 margin: 0 10px 0 10px;
 border: 1px solid #ebeef5;
 border-bottom: none;
 .list {
 display: flex;
 justify-content: space-between;
 border-bottom: 1px solid #ebeef5;
 // font-size: 16px;
 .label {
  width: 95px;
  border-right: 1px solid #ebeef5;
  padding: 10px 10px 10px 0;
  text-align: right;
  font-weight: 400;
 }
 .text {
  flex: 1;
  text-align: left;
  padding: 10px 30px 10px 10px;
  font-weight: 500;
  word-wrap: break-word; //超出文本行自動(dòng)換行
 word-break: break-all; //超出文本行自動(dòng)換行
 overflow: hidden; //超出文本行自動(dòng)換行
 }
 }
}
</style>

然后使用部分,先局內(nèi)引入注冊(cè)

然后使用

 <table-detail :detailData="companyDetail">
 // 這部分使我們自己要用的預(yù)覽文件的部分,不用的話可以不用寫(xiě)
   <template v-slot:file="{ files }">
    <app-upload
    :upload="new Upload(upload)"
    is-download
    is-preview
    is-view
    disabled
    />
    <ul>
    <li v-for="(file, i) in files" :key="i">
     {{ file.url }}
     <el-link
     type="primary"
     :href="file ? file.url : ''"
     target="_blank"
     >預(yù)覽</el-link
     >
     <el-link type="primary" @click="download(file)">下載</el-link>
    </li>
    </ul>
   </template>
   </table-detail>

在data 里面定義 companyDetail: [],

然后在methods里面獲取到數(shù)據(jù)之后賦值即可

this.companyDetail = [
   {
    label: `${this.labelTitle}項(xiàng)`,
    text: res.indexTitle
   },
   {
    label: `${this.labelTitle}值`,
    text: res.score
   },
   {
    label: `${this.labelTitle}時(shí)間`,
    text: this.$formatDate(res.reportTime, "YYYY.MM.DD", "YYYYMMDD")
   },
   {
    label: `${this.labelTitle}單位`,
    text: res.orgName
   },
   {
    label: `${this.labelTitle}原因`,
    text: res.description
   },
   {
    label: "申訴理由",
    text: res.reason
   },
   {
    label: "附件",
    prop: "file",
    text: files
   }
   ]

大致如上。

以上這篇Vue+Element自定義縱向表格表頭教程就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • Vue多重文字描邊組件實(shí)現(xiàn)示例詳解

    Vue多重文字描邊組件實(shí)現(xiàn)示例詳解

    這篇文章主要為大家介紹了Vue多重文字描邊組件實(shí)現(xiàn)示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-06-06
  • Vue前端實(shí)現(xiàn)截圖功能的簡(jiǎn)單步驟

    Vue前端實(shí)現(xiàn)截圖功能的簡(jiǎn)單步驟

    本文介紹了如何使用html2canvas庫(kù)來(lái)實(shí)現(xiàn)HTML頁(yè)面或某個(gè)元素的截圖功能,文中通過(guò)代碼介紹的非常詳細(xì),需要注意的是此方法只能在瀏覽器環(huán)境中使用,需要的朋友可以參考下
    2024-10-10
  • vue項(xiàng)目中l(wèi)oadsh庫(kù)常用方法說(shuō)明

    vue項(xiàng)目中l(wèi)oadsh庫(kù)常用方法說(shuō)明

    這篇文章主要介紹了vue項(xiàng)目中l(wèi)oadsh庫(kù)常用方法說(shuō)明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-11-11
  • 淺談Vue3的幾個(gè)優(yōu)勢(shì)

    淺談Vue3的幾個(gè)優(yōu)勢(shì)

    這篇文章主要給大家分享的是Vue3的幾個(gè)優(yōu)勢(shì),Vue3仍然在源碼、性能和語(yǔ)法 API 三個(gè)大的方面進(jìn)行了優(yōu)化,下面我們一起進(jìn)入文章看看具體詳情吧
    2021-10-10
  • vue?this.$router六種方法使用示例總結(jié)分析

    vue?this.$router六種方法使用示例總結(jié)分析

    這篇文章主要為大家介紹了vue this.$router六種方法使用示例總結(jié)分析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-06-06
  • vue-cli4項(xiàng)目開(kāi)啟eslint保存時(shí)自動(dòng)格式問(wèn)題

    vue-cli4項(xiàng)目開(kāi)啟eslint保存時(shí)自動(dòng)格式問(wèn)題

    這篇文章主要介紹了vue-cli4項(xiàng)目開(kāi)啟eslint保存時(shí)自動(dòng)格式的問(wèn)題小結(jié),本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-07-07
  • Vue代理報(bào)錯(cuò)404問(wèn)題及解決(vue配置proxy)

    Vue代理報(bào)錯(cuò)404問(wèn)題及解決(vue配置proxy)

    這篇文章主要介紹了Vue代理報(bào)錯(cuò)404問(wèn)題及解決(vue配置proxy),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-12-12
  • Vue組件庫(kù)Element-常見(jiàn)組件表格示例代碼

    Vue組件庫(kù)Element-常見(jiàn)組件表格示例代碼

    對(duì)于Element組件的使用,最主要的就是明確自己想要達(dá)到的效果,從官網(wǎng)中將對(duì)應(yīng)代碼復(fù)制粘貼即可,最重要的是要讀懂不同組件官網(wǎng)中提供的文檔,以便實(shí)現(xiàn)自己想要的效果,本文給大家介紹Vue組件庫(kù)Element-常見(jiàn)組件表格,感興趣的朋友一起看看吧
    2023-10-10
  • vue路由分文件拆分管理詳解

    vue路由分文件拆分管理詳解

    這篇文章主要介紹了vue路由分文件拆分管理詳解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2020-08-08
  • Vue 簡(jiǎn)單實(shí)現(xiàn)前端權(quán)限控制的示例

    Vue 簡(jiǎn)單實(shí)現(xiàn)前端權(quán)限控制的示例

    這篇文章主要介紹了Vue 簡(jiǎn)單實(shí)現(xiàn)前端權(quán)限控制的示例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-12-12

最新評(píng)論

怀柔区| 汾西县| 五常市| 兰州市| 象州县| 稷山县| 郁南县| 犍为县| 特克斯县| 理塘县| 牙克石市| 株洲市| 靖西县| 紫阳县| 民和| 江华| 牡丹江市| 南投县| 孝感市| 永善县| 石景山区| 宾川县| 鄱阳县| 云南省| 库尔勒市| 澄江县| 曲麻莱县| 凯里市| 皋兰县| 莱阳市| 建瓯市| 万盛区| 信丰县| 朝阳市| 鲜城| 铜川市| 冷水江市| 莱西市| 邢台县| 沙坪坝区| 陈巴尔虎旗|