<avue-crud :data="data" :option="option" ref="crud">
<template slot-scope="{row,index,type}" slot="menuForm">
<el-button type="primary"
icon="el-icon-check"
size="small"
v-if="type=='add'"
@click="$refs.crud.rowSave()"
>自定义新增</el-button>
<el-button type="primary"
icon="el-icon-check"
size="small"
v-if="type=='edit'"
@click="$refs.crud.rowUpdate()"
>自定义修改</el-button>
<el-button type="primary"
icon="el-icon-check"
size="small"
@click="$refs.crud.closeDialog()"
>取消</el-button>
</template>
</avue-crud>
<script>
export default {
data() {
return {
data: [
{
name:'张三',
sex:'男'
}, {
name:'李四',
sex:'女'
}
],
option:{
saveBtn:false,
updateBtn:false,
cancelBtn:false,
column:[
{
label:'姓名',
prop:'name'
}, {
label:'性别',
prop:'sex'
}
]
},
};
}
}
</script>
运行结果