亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

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

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

如下所示:

代碼如下:

<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ì)話框中彈出查看信息,打開時(shí)表格,要求是表頭在左側(cè)

 <table class="tableInfo" :model="editForm" id="printTest">
   <thead></thead>
   <tbody>
    <tr>
    <td>日?qǐng)?bào)類型</td>
    <td>{{editForm.daily_type | filterType}}</td>
    </tr>
    <tr>
    <td>開始時(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ù)覽文件的部分,不用的話可以不用寫
   <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自定義縱向表格表頭教程就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • vue使用v-for循環(huán)獲取數(shù)組最后一項(xiàng)

    vue使用v-for循環(huán)獲取數(shù)組最后一項(xiàng)

    這篇文章主要介紹了vue使用v-for循環(huán)獲取數(shù)組最后一項(xiàng)問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-03-03
  • Vue2使用cube-ui?實(shí)現(xiàn)搜索過濾、高亮功能

    Vue2使用cube-ui?實(shí)現(xiàn)搜索過濾、高亮功能

    cube-ui?是基于?Vue.js?實(shí)現(xiàn)的精致移動(dòng)端組件庫,由于很長一段時(shí)間沒有學(xué)習(xí)cube-ui?的功能實(shí)現(xiàn)示例代碼了,今天通過本文給大家介紹下Vue2使用cube-ui?實(shí)現(xiàn)搜索過濾、高亮功能,感興趣的朋友跟隨小編一起看看吧
    2023-01-01
  • Vue中Router路由兩種模式hash與history詳解

    Vue中Router路由兩種模式hash與history詳解

    這篇文章主要介紹了Vue中Router路由的兩種模式,分別對(duì)hash模式與history模式作了簡要分析,有需要的朋友可以借鑒參考下,希望能夠有所幫助
    2021-09-09
  • Vue組件上使用v-model之單選框

    Vue組件上使用v-model之單選框

    這篇文章主要介紹了Vue組件上使用v-model之單選框,代碼分為子組件內(nèi)容和父組件內(nèi)容,本文結(jié)合實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-10-10
  • vue2.0 better-scroll 實(shí)現(xiàn)移動(dòng)端滑動(dòng)的示例代碼

    vue2.0 better-scroll 實(shí)現(xiàn)移動(dòng)端滑動(dòng)的示例代碼

    本篇文章主要介紹了vue2.0 better-scroll 實(shí)現(xiàn)移動(dòng)端滑動(dòng)的示例代碼,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下。
    2018-01-01
  • 詳解如何使用Vuex實(shí)現(xiàn)Vue后臺(tái)管理中的角色鑒權(quán)

    詳解如何使用Vuex實(shí)現(xiàn)Vue后臺(tái)管理中的角色鑒權(quán)

    最近參與了公司一個(gè)新的B端項(xiàng)目的研發(fā),從無到有搭建項(xiàng)目的過程中,遇到了關(guān)于項(xiàng)目鑒權(quán)的問題,這篇文章主要給大家介紹了關(guān)于如何使用Vuex實(shí)現(xiàn)Vue后臺(tái)管理中的角色鑒權(quán)的相關(guān)資料,需要的朋友可以參考下
    2022-05-05
  • 前端Vue頁面中展示本地圖片簡單代碼示例

    前端Vue頁面中展示本地圖片簡單代碼示例

    今天遇到一個(gè)在vue文件中引入本地圖片的問題,于是有了這篇文章,本文主要給大家介紹了關(guān)于前端Vue頁面中展示本地圖片的相關(guān)資料,需要的朋友可以參考下
    2023-12-12
  • vue3生命周期原理與生命周期函數(shù)簡單應(yīng)用實(shí)例分析

    vue3生命周期原理與生命周期函數(shù)簡單應(yīng)用實(shí)例分析

    這篇文章主要介紹了vue3生命周期原理與生命周期函數(shù),結(jié)合簡單實(shí)例形式分析了vue3的生命周期基本原理、以及各個(gè)階段的生命周期鉤子函數(shù)功能、使用技巧與相關(guān)注意事項(xiàng),需要的朋友可以參考下
    2023-04-04
  • vue中 this.$set的使用詳解

    vue中 this.$set的使用詳解

    這篇文章主要為大家介紹了vue中 this.$set的使用,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下,希望能夠給你帶來幫助
    2021-11-11
  • 深入理解Vue的插件機(jī)制與install詳細(xì)

    深入理解Vue的插件機(jī)制與install詳細(xì)

    這篇文章主要介紹的是深入理解Vue的插件機(jī)制與install,文章主要是講解install函數(shù)可以做些什么、install內(nèi)部是怎么實(shí)現(xiàn)的、 Vuex,Vue-Router插件在install期間到底干了什么,需要的小伙伴可以參考一下
    2021-09-09

最新評(píng)論