<!--
 * @Author: wjc
 * @Date: 2025-04-09 10:19:11
 * @LastEditors: wjc
 * @LastEditTime: 2026-01-16 14:26:34
 * @Description: 自定义弹窗组件
-->
<template>
  <nut-dialog
    :title="title"
    :visible="visible"
    :cancel-text="cancelText"
    :ok-text="okText"
    v-bind="$attrs"
    @ok="onOk"
    @cancel="onCancel"
  >
    <slot></slot>
  </nut-dialog>
</template>

<script setup lang="ts">
  defineOptions({
    name: 'Auth',
    options: {
      virtualHost: true,
    },
  })
  withDefaults(
    defineProps<{
      cancelText?: string
      okText?: string
      title?: string
      visible: boolean
    }>(),
    {
      cancelText: '取消',
      okText: '确定',
      title: '提示',
      visible: false,
    }
  )
  const emits = defineEmits<{
    (e: 'confirm'): void
    (e: 'cancel'): void
  }>()
  const onOk = () => {
    emits('confirm')
  }

  const onCancel = () => {
    emits('cancel')
  }
</script>
