# 普通用法

点击查看代码
<template>
  <div>
    <ygp-crud :data="data" :option="option" @openDialogGoods="openDialogGoods"></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: {
        operate: [
          {
            title: "增加行",
            operate: "openDialogGoods",
          },
        ],
        columns: [
          {
            label: "姓名",
            prop: "name",
          },
          {
            label: "性别",
            prop: "sex",
          },
          {
            label: "日期",
            prop: "date",
          },
        ],
      },
    };
  },
  methods: {
    openDialogGoods() {
      this.$message.success("触发增加行方法");
    },
  },
};