饿了么表格封装!!

菜鸟前端实时记录

每次写完的代码过段时间就会忘 在这里记录下给表格加上width100% 当内容超出时就会有x轴滚动条 每次都忘 每次都百度 

ps:外层盒子没有overflow:hidden的情况下

             <el-table
                v-if="activeName == 'third'"
                :data="planData"
                :height="`calc(100vh - 450px)`"
                :header-cell-style="{ 'text-align': 'center' }"
                :cell-style="{ textAlign: 'center' }"
                border
                v-loading="loading"
                width="100%"
              >
                <template v-for="col in columns">
                  <el-table-column
                    :key="col.prop"
                    :prop="col.prop"
                    :label="col.label()"
                    v-if="col.show()"
                    :width="col.width"
                    show-overflow-tooltip
                  >
                    <template slot-scope="scope">
                      <template v-if="col.prop == 'advertiser_name'">
                        <div
                          style="width: 100%;overflow: hidden;  white-space: nowrap; text-overflow: ellipsis;"
                        >
                          <span style="color: #338aff;" @click="jump(scope.row)">{{
                            scope.row.advertiser_name
                          }}</span
                          ><br />
                          <span>(账户ID:{{ scope.row.advertiser_id }})</span>
                        </div>
                      </template>
                      <template v-else-if="col.prop === 'ad_create_time'">
                        <div style="width: 100%; text-align: center;">
                          {{ scope.row.ad_create_time | dateFormat }}
                        </div>
                      </template>
                      <template v-else-if="col.prop === 'cost'">
                        <div style="width: 100%; text-align: center;">
                          ¥{{ scope.row.cost | homeSplit }}
                        </div>
                      </template>
                      <template v-else>
                        <span v-text="scope.row[col.prop]"></span>
                      </template>
                    </template>
                  </el-table-column>
                </template>
              </el-table>

    columns: [
        {
          label: _ => '广告账户名称',
          prop: 'advertiser_name',
          show: _ => true,
          sort: true,
          width: 350
        },
        {
          label: _ => '广告ID',
          prop: 'promotion_id',
          show: _ => true,
          sort: true,
          width: 250
        },
        {
          label: _ => '项目ID',
          prop: 'project_id',
          show: _ => true,
          sort: true,
          width: 250
        },
        {
          label: _ => '投手',
          prop: 'user_name',
          show: _ => true,
          sort: true
        },
        {
          label: _ => '素材消耗',
          prop: 'cost',
          show: _ => true,
          sort: true
        },
        {
          label: _ => '实际投放天数',
          prop: 'day_count',
          show: _ => true,
          sort: true,
          width: 150
        },
        {
          label: _ => '广告搭建时间',
          prop: 'ad_create_time',
          show: _ => true,
          sort: true,
          width: 150
        }
      ],

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

随时提桶de

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值