插槽写入列点击事件
js
<div class="le-table-box" ref="TableBoxRef" :style="{ height: ShowPage ? 'calc(100% - 60px)' : '100%' }">
<lay-table @row-double="dbRowClick" :columns="TableColumn" :data-source="TableData" :max-height="tableHeight"
:rowClassName="RowClassChange" :id="CheckKey" v-model:[TableType]="SelectedKey" @on-select="handleSelect"
@row="rowClick" ref="LayTableRef" v-bind="TableConfig">
<!-- 通过自定传入插槽实现 -->
<template #date="{ row, column }">
<span>{{ formatterDate(row[column.key]) }}</span>
</template>
<template #image="{ row, column }">
<img :src="row[column.key]" alt="" srcset="" @error="imgLoadError">
</template>
<template v-slot:operator="{ row, rowIndex }">
<slot name="Controls" :index="rowIndex" :row="row" />
</template>
<template #cell="{ row, column }">
<span @dblclick="dblclickColumnFun(row, column, row[column.key])">{{ row[column.key] }}</span>
</template>
</lay-table>
<div v-if="IsSwitchObj.isShow && TableData.length" class="switch-btn-group"
:style="{ right: switchRight, top: switchTop }" @click="switchBtnClick">
<img v-show="!switchRight" src="@/assets/nav_icon/switch-left.png" alt srcset />
<img v-show="switchRight" src="@/assets/nav_icon/switch-right.png" alt srcset />
</div>
</div>
js
const dblclickColumnFun = (row, column, key) => {
emit("DblclickColumEmit", row, column, key);
}
js
const tableColumn = ref([
{
title: "点位名称",
key: "name",
width: "120px",
align: "center",
ellipsisTooltip: true, // 内容超出隐藏
},
{
title: "编号",
key: "indexCode",
width: "180px",
align: "center",
ellipsisTooltip: true,
},
{
title: "违规数",
key: "num",
width: "180px",
align: "center",
ellipsisTooltip: true,
customSlot:'cell',
}, {
title: "审核流转数",
key: "liuzhuan",
width: "180px",
align: "center",
ellipsisTooltip: true,
customSlot:'cell',
},
{
title: "利用率",
key: "liyl",
width: "180px",
align: "center",
ellipsisTooltip: true,
}
])
row
column