【Arco】表格自定义信息布局

发布时间:2024年01月12日

效果
在这里插入图片描述

<template>

      <!-- 表格 -->
      <a-table :data="data" style="margin-top: 30px" :bordered="false">
        <template #columns>
          <a-table-column
            title="商品信息"
            :header-cell-style="{ paddingLeft: '30px' }"
            width="276"
            data-index="salary"
          >
            <template #cell="{ record }">
              <a-row class="grid-demo">
                <a-col :span="24">
                  <div class="b_t_s_d">
                    <div class="b_t_s_d_text"> 订单编号:20240110123456 </div>
                    <img
                      src="@/assets/images/copy.png"
                      style="width: 22px; height: 22px; cursor: pointer"
                    />
                  </div>
                  <div
                    v-for="(item, index) in record.kk"
                    :key="index"
                    class="b_t_s_d_s"
                  >
                    1
                  </div>
                </a-col>
              </a-row>
            </template>
          </a-table-column>
          <a-table-column title="价格" width="220" align="center">
            <template #cell="{ record }">
              <a-row class="grid-demo">
                <a-col :span="24">
                  <div class="b_t_s_d">
                    <div class="b_t_s_d_text"> 下单时间:2024/01/10 15:50 </div>
                  </div>
                  <div
                    v-for="(item, index) in record.kk"
                    :key="index"
                    class="b_t_s_d_s"
                  >
                    1
                  </div>
                </a-col>
              </a-row>
            </template>
          </a-table-column>
          <a-table-column title="总价格" width="231" align="center">
            <template #cell="{ record }">
              <a-row class="grid-demo">
                <a-col :span="24">
                  <div class="b_t_s_d">
                    <div class="b_t_s_d_text"> 支付时间:2024/01/10 15:56 </div>
                  </div>
                  <div
                    class="b_t_s_d_s"
                    :style="{ height: record.kk.length * 114 + 'px' }"
                  >
                    {{ record.kk.length }}
                  </div>
                </a-col>
              </a-row>
            </template>
          </a-table-column>
          <a-table-column title="买家" width="246" align="center">
            <template #cell="{ record }">
              <a-row class="grid-demo">
                <a-col :span="24">
                  <div class="b_t_s_d">
                    <div class="b_t_s_d_text"> 通路:电视购物 </div>
                  </div>
                  <div
                    class="b_t_s_d_s"
                    :style="{ height: record.kk.length * 114 + 'px' }"
                  >
                    {{ record.kk.length }}
                  </div>
                </a-col>
              </a-row>
            </template>
          </a-table-column>
          <a-table-column title="收货信息" align="center">
            <template #cell="{ record }">
              <a-row class="grid-demo">
                <a-col :span="24">
                  <div class="b_t_s_d"></div>
                  <div
                    class="b_t_s_d_s"
                    :style="{ height: record.kk.length * 114 + 'px' }"
                  >
                    {{ record.kk.length }}
                  </div>
                </a-col>
              </a-row>
            </template>
          </a-table-column>
          <a-table-column title="订单状态" align="center">
            <template #cell="{ record }">
              <a-row class="grid-demo">
                <a-col :span="24">
                  <div class="b_t_s_d"></div>
                  <div
                    class="b_t_s_d_s"
                    :style="{ height: record.kk.length * 114 + 'px' }"
                  >
                    {{ record.kk.length }}
                  </div>
                </a-col>
              </a-row>
            </template>
          </a-table-column>
        </template>
      </a-table>
</template>

<script lang="ts" setup>
  
  const data = ref([
    {
      id: 1,
      name: '1',
      kk: [
        { id: 1, name: '1-1' },
        { id: 2, name: '1-2' },
      ],
    },
  ]);

</script>

<style scoped lang="less">
  
  .b_t_s_d {
    width: 100%;
    height: 50px;
    background: #f3f8ff;
    color: rgb(78, 89, 105);
    font-family: PingFang SC;
    font-size: 14px;
    font-weight: 500;
    line-height: -1px;
    letter-spacing: 0px;
    text-align: left;
    // 垂直居中
    display: flex;
    align-items: center;
    // 水平居中
    // justify-content: center;
    .b_t_s_d_text {
      margin-left: 30px;
    }
  }
  .b_t_s_d_s {
    width: 100%;
    height: 114px;
    border-right: 1px solid rgb(240, 240, 240);
    border-bottom: 1px solid rgb(240, 240, 240);
  }
  .y3-content-table :deep .arco-table-cell {
    padding: 10px 0px;
  }
</style>

文章来源:https://blog.csdn.net/weixin_44646977/article/details/135554414
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。