zss
昨天 b3f2fb5aef5945a5b7790d41cdb9504d1650c1e5
src/components/PIMTable/PIMTable.vue
@@ -41,7 +41,8 @@
                     :align="item.align"
                     :sortable="!!item.sortable"
                     :type="item.type"
                     :width="item.width">
                     :width="item.width"
                     :class-name="item.className || ''">
      <template #header="scope">
        <div class="pim-table-header-cell">
          <div class="pim-table-header-title">
@@ -85,9 +86,9 @@
              typeof dataTypeFn(scope.row[item.prop], item.formatData) ===
              'string'
            "
                  :title="formatters(scope.row[item.prop], item.formatData)"
                  :title="formatters(scope.row[item.prop], item.formatData, scope.row)"
                  :type="formatType(scope.row[item.prop], item.formatType)">
            {{ formatters(scope.row[item.prop], item.formatData) }}
            {{ formatters(scope.row[item.prop], item.formatData, scope.row) }}
          </el-tag>
          <el-tag v-for="(tag, index) in dataTypeFn(
              scope.row[item.prop],
@@ -98,14 +99,14 @@
              'object'
            "
                  :key="index"
                  :title="formatters(scope.row[item.prop], item.formatData)"
                  :title="formatters(scope.row[item.prop], item.formatData, scope.row)"
                  :type="formatType(tag, item.formatType)">
            {{ item.tagGroup ? tag[item.tagGroup.label] ?? tag : tag }}
          </el-tag>
          <el-tag v-else
                  :title="formatters(scope.row[item.prop], item.formatData)"
                  :title="formatters(scope.row[item.prop], item.formatData, scope.row)"
                  :type="formatType(scope.row[item.prop], item.formatType)">
            {{ formatters(scope.row[item.prop], item.formatData) }}
            {{ formatters(scope.row[item.prop], item.formatData, scope.row) }}
          </el-tag>
        </div>
        <!-- 按钮 -->
@@ -171,6 +172,7 @@
        <!-- 可点击的文字 -->
        <div v-else-if="item.dataType == 'link'"
             class="cell link"
             :class="item.className || ''"
             style="width: 100%"
             @click="goLink(scope.row, item.linkMethod)">
          <span v-if="!item.formatData">{{ scope.row[item.prop] }}</span>
@@ -178,10 +180,11 @@
        <!-- 默认纯展示数据 -->
        <div v-else
             class="cell"
             :class="item.className || ''"
             style="width: 100%">
          <span v-if="!item.formatData">{{ scope.row[item.prop] }}</span>
          <span v-else>{{
            formatters(scope.row[item.prop], item.formatData)
            formatters(scope.row[item.prop], item.formatData, scope.row)
          }}</span>
        </div>
      </template>
@@ -217,8 +220,8 @@
    return typeof val === "function" ? val(row) : val;
  };
  const formatters = (val, format) => {
    return typeof format === "function" ? format(val) : val;
  const formatters = (val, format, row) => {
    return typeof format === "function" ? format(val, row) : val;
  };
  // Props(使用 defineProps 的非 TS 形式)