公西颖初 发表于 2025-6-25 09:31:03

vxe-table vue 表格禁用单元格编辑的2种实现方式

vxe-table vue 表格禁用单元格编辑的2种实现方式
查看官网:https://vxetable.cn
gitbub:https://github.com/x-extends/vxe-table
gitee:https://gitee.com/x-extends/vxe-table
阻止激活编辑

设置 edit-config 的 beforeEditMethod 方法判断单元格是否禁用,例如:限制第二行不允许编辑

<template>

    <vxe-grid v-bind="gridOptions" v-on="gridEvents">
      <template #edit_name="{ row }">
      <vxe-input v-model="row.name"></vxe-input>
      </template>

      <template #edit_sex="{ row }">
      <vxe-input v-model="row.name"></vxe-input>
      </template>

      <template #edit_age="{ row }">
      <vxe-input v-model="row.name"></vxe-input>
      </template>

      <template #edit_address="{ row }">
      <vxe-input v-model="row.name"></vxe-input>
      </template>
    </vxe-grid>

</template>禁用编辑控件

通过 disabled 方式禁用控件,实现行编辑中对列的权限控制

<template>

    <vxe-grid v-bind="gridOptions" v-on="gridEvents">
      <template #edit_name="{ row }">
      <vxe-input v-model="row.name"></vxe-input>
      </template>

      <template #edit_sex="{ row }">
      <vxe-input v-model="row.name"></vxe-input>
      </template>

      <template #edit_age="{ row }">
      <vxe-input v-model="row.name"></vxe-input>
      </template>

      <template #edit_address="{ row }">
      <vxe-input v-model="row.name"></vxe-input>
      </template>
    </vxe-grid>

</template>https://gitee.com/x-extends/vxe-table

来源:程序园用户自行投稿发布,如果侵权,请联系站长删除
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!

茅断卉 发表于 2025-10-14 16:56:04

这个好,看起来很实用

祺簇 发表于 2025-10-26 00:48:30

用心讨论,共获提升!

觐有 发表于 2025-11-7 00:10:27

yyds。多谢分享

松菊 发表于 2025-11-12 19:21:06

东西不错很实用谢谢分享

晾棋砷 发表于 2025-11-14 02:23:56

这个有用。

晚能 发表于 2025-11-21 04:49:11

谢谢分享,辛苦了

事确 发表于 2025-11-26 19:32:33

收藏一下   不知道什么时候能用到

篙菠 发表于 2025-12-22 01:43:38

新版吗?好像是停更了吧。

博咱 发表于 2026-1-4 00:22:00

新版吗?好像是停更了吧。

愤血冒 发表于 2026-1-4 19:25:26

感谢分享,下载保存了,貌似很强大

常士 发表于 2026-1-8 19:45:19

鼓励转贴优秀软件安全工具和文档!

要燥 发表于 2026-1-15 16:23:44

鼓励转贴优秀软件安全工具和文档!

蚬蕞遂 发表于 2026-1-18 22:12:29

yyds。多谢分享

替攀浮 发表于 2026-1-20 08:01:32

前排留名,哈哈哈

任俊慧 发表于 2026-1-20 17:52:07

分享、互助 让互联网精神温暖你我

忙贬 发表于 2026-1-22 21:50:07

新版吗?好像是停更了吧。

赴忽 发表于 2026-1-24 05:59:25

热心回复!

米嘉怡 发表于 2026-1-28 18:16:09

过来提前占个楼

闾丘婉奕 发表于 2026-1-30 04:05:39

懂技术并乐意极积无私分享的人越来越少。珍惜
页: [1] 2
查看完整版本: vxe-table vue 表格禁用单元格编辑的2种实现方式