# 普通用法
点击查看代码
<template>
<div>
<ygp-crud :data="data" :option="option">
<template slot="menu" slot-scope="{ row, size, index }">
<el-button
type="text"
:size="size"
@click="openDialogTransfer(row, index)"
>自定义菜单按钮</el-button>
</template>
</ygp-crud>
</div>
</template>
export default {
data() {
return {
data: [
{
name: "张三",
sex: "男",
date: "1994-02-23 00:00:00",
},
{
name: "李四",
sex: "女",
date: "1994-02-23 00:00:00",
},
{
name: "王五",
sex: "女",
date: "1994-02-23 00:00:00",
},
{
name: "赵六",
sex: "男",
date: "1994-02-23 00:00:00",
},
],
option: {
menu: true,
columns: [
{
label: "姓名",
prop: "name",
},
{
label: "性别",
prop: "sex",
},
{
label: "日期",
prop: "date",
},
],
},
};
},
methods: {
openDialogTransfer() {
this.$message.success("触发自定义菜单按钮方法");
}
}
};