js日期2

  <el-table-column prop="lyLx" header-align="center" align="center" label="来源类型" :formatter="lxFormat" width="90px"></el-table-column>

        <el-table-column header-align="center" align="center" label="有效期至" width="120px">
          <template slot-scope="scope">
            <!--{{$moment(scope.row.yxqz).format("YYYY-MM-DD")}}-->
            <!--{{new Date().getTime()}}-->
            <!--{{new Date(scope.row.yxqz)}}-->
            <div v-if="new Date(scope.row.yxqz).getTime() >= new Date().getTime()">
              <span>{{$moment(scope.row.yxqz).format("YYYY-MM-DD")}}</span>
            </div>
            <div v-else>
              <span style="color: red">{{$moment(scope.row.yxqz).format("YYYY-MM-DD")}}</span>
            </div>
          </template>
        </el-table-column>

方法

    lxFormat(row, column, cellValue, index){
      if(cellValue == 1 ){
        return '上级分配';
      }else {
        return '单位自筹'
      }
    }
posted @ 2021-08-18 18:59  寒冷的雨呢  阅读(34)  评论(0编辑  收藏  举报