关于 el-table-column 加上key仍然不按顺序显示的问题

这个问题,在查百度前,我花了近1个小时,后来百度后,几分钟解决。原因是,不管v-if v-for等指令,请不要用<div> 或<li>标签封装,说多了都是泪。

 

附上正确的模板,什么KEY可以确定排序的,KEY在这个环境中根本起不了作用

 <template v-for="index in monthDay">
            <el-table-column align="center" type="index" :label="index+''">
              <el-table-column v-if="weekJiList[index-1]==1" align="center" width="40" :label="$t('attendance.Monday')">
                <template slot-scope="scope">
                </template>
              </el-table-column>
              <el-table-column v-if="weekJiList[index-1]==2" align="center" width="40" :label="$t('attendance.Tuesday')">
                <template slot-scope="scope">
                </template>
              </el-table-column>
              <el-table-column v-if="weekJiList[index-1]==3" align="center" width="40" :label="$t('attendance.Wednesday')">
                <template slot-scope="scope">
                </template>
              </el-table-column>
              <el-table-column v-if="weekJiList[index-1]==4" align="center" width="40" :label="$t('attendance.thursday')">
                <template slot-scope="scope">
                </template>
              </el-table-column>
              <el-table-column v-if="weekJiList[index-1]==5" align="center" width="40" :label="$t('attendance.Friday')">
                <template slot-scope="scope">
                </template>
              </el-table-column>
              <el-table-column v-if="weekJiList[index-1]==6" align="center" width="40" :label="$t('attendance.Saturday')">
                <template slot-scope="scope">
                </template>
              </el-table-column>
              <el-table-column v-if="weekJiList[index-1]==7" align="center" width="40" :label="$t('attendance.Sunday')">
                <template slot-scope="scope">
                </template>
              </el-table-column>
            </el-table-column>
          </template>

          <!-- 应出勤天数 -->
          <el-table-column align="center" width="40" :label="$t('attendance.attendanceNumber')">
            <template slot-scope="scope">
              <span>{{ scope.row.totalAttendance }}</span>
            </template>
          </el-table-column>

 

  • 4
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值