<template>
  <kk-button text type="primary" @click="dialogVisible = true">
    打开对话框
  </kk-button>

  <kk-dialog
    v-model="dialogVisible"
    title="Tips"
    width="30%"
    :before-close="handleClose"
  >
    <span>This is a message</span>
    <template #footer>
      <span class="dialog-footer">
        <kk-button @click="dialogVisible = false">Cancel</kk-button>
        <kk-button type="primary" @click="dialogVisible = false">
          Confirm
        </kk-button>
      </span>
    </template>
  </kk-dialog>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import { KkButton, KkDialog } from 'kankan-components'

const dialogVisible = ref(false)

const handleClose = (done: () => void) => {
  done()
}
</script>
<style scoped>
.dialog-footer button:first-child {
  margin-right: 10px;
}
</style>
