# useConfirmDialog 确认对话框

基于 useFormDialog 实现的确认对话框，内置 textarea 输入框，适用于审批意见、备注填写等场景。

## 基本用法

```vue
<template>
  <el-button @click="handleConfirm">审批</el-button>
</template>

<script setup lang="tsx">
import { useConfirmDialog } from 'el-plus'

const ConfirmDialog = useConfirmDialog({
  title: '审批确认',
  placeholder: '请输入审批意见',
})

const handleConfirm = async () => {
  try {
    const result = await ConfirmDialog.open()
    console.log '确认，意见：', result.value)
  } catch (e) {
    console.log('取消')
  }
}
</script>
```

## Options

| 属性 | 说明 | 类型 | 默认值 |
|------|------|------|--------|
| title | 对话框标题 | `string` | - |
| width | 对话框宽度 | `string` | `'50%'` |
| dialogProps | 对话框属性，继承自 useDialog | `DialogOptions` | - |
| rows | textarea 行数 | `number` | `5` |
| maxlength | 最大输入长度 | `number` | `500` |
| minlength | 最小输入长度 | `number` | - |
| showWordLimit | 显示字数统计 | `boolean` | `true` |
| placeholder | 输入框占位符 | `string` | - |
| rules | 表单验证规则 | `FormItemProps['rules']` | - |
| required | 是否必填 | `boolean` | `true` |

## 自定义验证

```tsx
const ConfirmDialog = useConfirmDialog({
  title: '驳回原因',
  required: true,
  rules: [
    { required: true, message: '请输入驳回原因', trigger: 'blur' },
    { min: 10, message: '驳回原因不能少于10个字', trigger: 'blur' },
  ],
  placeholder: '请输入驳回原因（不少于10个字）',
})
```

## 非必填确认

```tsx
const ConfirmDialog = useConfirmDialog({
  title: '备注',
  required: false, // 非必填
  placeholder: '请输入备注（选填）',
})
```

## 返回值

确认时返回表单数据对象：

```ts
{
  value: string // textarea 输入的内容
}
```

## 方法

| 方法 | 说明 | 类型 |
|------|------|------|
| open | 打开对话框并返回 Promise | `() => Promise<{ value: string }>` |
| open | 打开对话框 | `() => void` |
| close | 关闭对话框 | `() => void` |
