找回密码
 立即注册
首页 资源区 代码 vxe-table vue 表格禁用单元格编辑的2种实现方式 ...

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

公西颖初 2025-6-25 09:31:03
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 方法判断单元格是否禁用,例如:限制第二行不允许编辑
1.gif
  1. <template>
  2.   
  3.     <vxe-grid v-bind="gridOptions" v-on="gridEvents">
  4.       <template #edit_name="{ row }">
  5.         <vxe-input v-model="row.name"></vxe-input>
  6.       </template>
  7.       <template #edit_sex="{ row }">
  8.         <vxe-input v-model="row.name"></vxe-input>
  9.       </template>
  10.       <template #edit_age="{ row }">
  11.         <vxe-input v-model="row.name"></vxe-input>
  12.       </template>
  13.       <template #edit_address="{ row }">
  14.         <vxe-input v-model="row.name"></vxe-input>
  15.       </template>
  16.     </vxe-grid>
  17.   
  18. </template>
复制代码
禁用编辑控件

通过 disabled 方式禁用控件,实现行编辑中对列的权限控制
2.gif
  1. <template>
  2.   
  3.     <vxe-grid v-bind="gridOptions" v-on="gridEvents">
  4.       <template #edit_name="{ row }">
  5.         <vxe-input v-model="row.name"></vxe-input>
  6.       </template>
  7.       <template #edit_sex="{ row }">
  8.         <vxe-input v-model="row.name"></vxe-input>
  9.       </template>
  10.       <template #edit_age="{ row }">
  11.         <vxe-input v-model="row.name"></vxe-input>
  12.       </template>
  13.       <template #edit_address="{ row }">
  14.         <vxe-input v-model="row.name"></vxe-input>
  15.       </template>
  16.     </vxe-grid>
  17.   
  18. </template>
复制代码
https://gitee.com/x-extends/vxe-table

来源:程序园用户自行投稿发布,如果侵权,请联系站长删除
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
您需要登录后才可以回帖 登录 | 立即注册