Browse Source

!928 解决封装的table不支持formatter的问题
Merge pull request !928 from Mr先生/N/A

zuohuaijun 2 years ago
parent
commit
7d915ca81f
1 changed files with 2 additions and 0 deletions
  1. 2 0
      Web/src/components/table/index.vue

+ 2 - 0
Web/src/components/table/index.vue

@@ -55,9 +55,11 @@
 			<el-table-column v-for="(item, index) in setHeader" :key="index" v-bind="item">
 				<!-- 自定义列插槽,插槽名为columns属性的prop -->
 				<template #default="scope" v-if="(!item.children) && $slots[item.prop]">
+                <span v-if="item.formatter">{{ item.formatter ? item.formatter(scope.row,scope.column,scope.cellValue,scope.index) : scope.row[item.key] }}</span>
 					<slot :name="item.prop" v-bind="scope"></slot>
 				</template>
 				<template v-else-if="!item.children" v-slot="scope">
+                <span v-if="item.formatter">{{ item.formatter ? item.formatter(scope.row,scope.column,scope.cellValue,scope.index) : scope.row[item.key] }}</span>
 					<template v-if="item.type === 'image'">
 						<el-image :style="{ width: `${item.width}px`, height: `${item.height}px` }"
 							:src="scope.row[item.prop]" :zoom-rate="1.2" :preview-src-list="[scope.row[item.prop]]"