layui-vue第三方库表格列事件怎么写

插槽写入列点击事件

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

相关推荐
雾恋17 小时前
最近一年的感悟
前端·javascript·程序员
华仔啊17 小时前
Vue3 的 ref 和 reactive 到底用哪个?90% 的开发者都选错了
javascript·vue.js
A黄俊辉A18 小时前
axios+ts封装
开发语言·前端·javascript
小李小李不讲道理18 小时前
「Ant Design 组件库探索」四:Input组件
前端·javascript·react.js
郑板桥3019 小时前
tua-body-scroll-lock踩坑记录
前端·javascript
IT古董19 小时前
Vue + Vite + Element UI 实现动态主题切换:基于 :root + SCSS 变量的最佳实践
vue.js·ui·scss
解道Jdon19 小时前
SpringBoot4与Spring7发布:云原生深度进化
javascript·reactjs
gnip20 小时前
pnpm 的 monorepo架构多包管理
前端·javascript
zolty20 小时前
基于hiprint的票据定位打印系统开发实践
javascript
百思可瑞教育1 天前
使用UniApp实现一个AI对话页面
javascript·vue.js·人工智能·uni-app·xcode·北京百思可瑞教育·百思可瑞教育