-
使用插槽给操作列添加编辑按钮
定义插槽slot
<span slot="action" slot-scope="text, record"> <a>编辑</a> </span>
column中添加操作列定义,并绑定插槽
{ title: '操作', dataIndex: 'action', scopedSlots: {customRender: 'action'}, align: "center", width: 170 }
-
编写编辑页面组件
-
列表页面导入组件
import UserModal from './system/modules/UserModal'
-
调用组件
<userModal ref="modalForm" @ok="modalFormOk"></userModal>
常见组件调用方式(导入名称
UserModal
为例 ):
1、直接使用 导入时名称如:UserModal
,
2、首单词首字母小写,其他单词首字母大写:userModal
3、首单词大写或者全部小写,多个单词使用-
连接:User-Modal
、user-modal
ref
指定ref组件,方便页面其他组件调用
@ok
指定ok函数 -
编辑页面click调用
mixins
中的handleEdit
函数并将当前行的值传入
<a @click="handleEdit(record)">编辑</a>
-
点击编辑,handleEdit函数调用UserModal中的edit函数
jeecg boot 框架学习(3)— 列表编辑页面处理
最新推荐文章于 2025-04-11 12:20:00 发布