<template>
  <div>
    <lyf-button @click="show()">api打开对话框</lyf-button>
    <br>
    <lyf-button @click="show3()">api打开对话框2</lyf-button>
    <br>
    <lyf-button @click="show2()">组件使用打开对话框</lyf-button>
    <lyf-dialog
      :visible.sync="h"
      title="组件使用打开对话框"
      message="dd"
      @confirm="confirmCallback"
      @cancel="cancelCallback"
    >
      <div>102额、</div>
      <div>打扫了；da</div>
    </lyf-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      h: false
    }
  },
  mounted() {
    // this.show()
  },
  methods: {
    show() {
      this.lyfDialog({
        title: 'api打开对话框',
        message: '确定删除吗确定删除吗确定删除吗确定删除吗确定删除吗？？',
        confirmText: '我知道了',
        confirm: () => {
          console.log('1');
          // this.confirmCallback()
        },
        finally: () => {
          this.cancelCallback()
        }
      })
    },
    show3() {
      this.lyfDialog({
        title: 'api打开对话框',
        confirm: () => {
          console.log('1');
          // this.confirmCallback()
        },
        finally: () => {
          this.cancelCallback()
        }
      })
    },
    show2() {
      console.log(2);
      this.h = true
    },
    confirmCallback() {
      console.log('父组件 confirm')
      this.lyfHideDialog()
    },
    cancelCallback() {
      console.log('父组件 cancel')
      this.lyfHideDialog()
    }
  }
}
</script>

<style lang="scss" scoped></style>