张诺
5 天以前 f1b3a5d1e7824d44a280b65d82a81231ae699942
src/components/Table/EtableModify.vue
@@ -28,11 +28,9 @@
      type="index"
      width="60"
      align="center"
    />    <template v-for="col in columns" :key="col.prop">
      <el-table-column
        v-bind="col"
        align="center"
      >
    />
    <template v-for="col in columns" :key="col.prop">
      <el-table-column v-bind="col" align="center">
        <template #default="scope">
          <template v-if="col.slot">
            <slot
@@ -41,7 +39,8 @@
              :column="scope.column"
              :index="scope.$index"
            ></slot>
          </template>          <template v-else>
          </template>
          <template v-else>
            <div
              class="cell-edit"
              @dblclick="handleCellEdit(scope.row, col.prop)"
@@ -53,7 +52,12 @@
                class="cell-text"
              >
                {{
                  formatCellValue(scope.row, scope.column, scope.row[col.prop], col)
                  formatCellValue(
                    scope.row,
                    scope.column,
                    scope.row[col.prop],
                    col
                  )
                }}
              </span>
              <!-- 编辑状态:使用原始值,不经过格式化 -->
@@ -201,7 +205,7 @@
// 格式化单元格值
const formatCellValue = (row, column, cellValue, col) => {
  // 如果列有自定义格式化器,使用自定义格式化器
  if (col.formatter && typeof col.formatter === 'function') {
  if (col.formatter && typeof col.formatter === "function") {
    return col.formatter(row, column, cellValue);
  }
  // 否则使用默认格式化器