<template>
  <el-dialog
      :visible="show"
      :title="title"
      width="400px"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      @close="close">
    {{ content }}
    <div slot="footer">
      <el-button type="primary" @click="submit">
        {{ labels.length > 0 ? labels[0] : (mode === 'confirm' ? '确定' : '是') }}
      </el-button>
      <el-button v-if="mode === 'determine'" type="danger" @click="cancel">
        {{ labels.length > 1 ? labels[1] : '否' }}
      </el-button>
      <el-button @click="close">取消</el-button>
    </div>
  </el-dialog>
</template>

<script>
  export default {
    data() {
      return {
        show: false,
        title: '提示',
        content: '是否确认？',
        mode: '',
        labels: []
      }
    },
    methods: {
      submit() {
        this.close();
        this.callback(true);
      },
      cancel() {
        this.close();
        this.callback(false);
      },
      close() {
        this.show = false;
      }
    }
  };
</script>

<style lang="less" scoped>

</style>
