<template>
  <div class="inline-16">
    <el-popconfirm title="确定删除当前产品吗？" @confirm="deleteRow()">
      <el-button slot="reference" size="small" type="text">删 除</el-button>
    </el-popconfirm>
  </div>
</template>

<script>
/* 
id:数据id
nameId:接口id
nameKey:接口字段
 */
export default {
  props: ['id','nameId','nameKey'],
  data () {
    return {
      param: {
        "id":this.nameId,
        "version":1,
        "content": {
            [this.nameKey]:[this.id]
        }
      }
    }
  },
  methods: {
    async deleteRow() {
      let res = await this.$api.requested(this.param)
      this.tool.showMessage(res,() => {
        this.$emit('deleteSuccess')
      })
    },
  },
  created () {
    this.$emit('deleteCreate',this.param)
  }
}

</script>
