Commit d2bf561f authored by Cai Wei's avatar Cai Wei

feat(*): 表格新增测试标记

parent 4b32bc3e
...@@ -11,14 +11,17 @@ ...@@ -11,14 +11,17 @@
<template v-for="column in columns" :key="column.prop"> <template v-for="column in columns" :key="column.prop">
<el-table-column v-bind="column" :align="align"> <el-table-column v-bind="column" :align="align">
<template #default="scope"> <template #default="scope">
<slot <!-- 在每个td里包一层span,追加唯一的 data-testid -->
:name="column.prop" <span :data-testid="`cell-${scope.$index}-${column.prop}`">
v-bind="scope" <slot
:row="scope.row" :name="column.prop"
:column="column" v-bind="scope"
> :row="scope.row"
{{ scope.row[column.prop] }} :column="column"
</slot> >
{{ scope.row[column.prop] }}
</slot>
</span>
</template> </template>
</el-table-column> </el-table-column>
</template> </template>
...@@ -43,6 +46,7 @@ ...@@ -43,6 +46,7 @@
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, computed, watch, onMounted, onUnmounted, nextTick } from "vue"; import { ref, computed, watch, onMounted, onUnmounted, nextTick } from "vue";
...@@ -225,7 +229,6 @@ watch( ...@@ -225,7 +229,6 @@ watch(
} }
} }
</style> </style>
<<<<<<< HEAD
<style lang="scss"> <style lang="scss">
.el-table__header, .el-table__header,
...@@ -244,5 +247,3 @@ watch( ...@@ -244,5 +247,3 @@ watch(
} }
} }
</style> </style>
=======
>>>>>>> 14bd703db4380d50659b719495c761ed24c2c0d5
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment