Skip to content

FinAlert 提示框 ​

组件与命名规范:组件名主推 FAlert,别名导出 FinAlert。

用于页面中展示重要的提示信息。

基础用法 ​

loading

API ​

FinAlertProps ​

属性名类型默认值说明
type'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'error''default'提示类型
titlestring-标题文本
descriptionstring-描述性文本(可选)
showIconbooleantrue是否显示图标
closablebooleanfalse是否可关闭
closeTextstring-关闭按钮文本(默认显示 × 图标)
centerbooleanfalse是否居中显示
iconstring-自定义图标组件名

FinAlertEmits ​

事件名回调参数说明
close() => void关闭提示框时触发

FinAlertSlots ​

插槽名说明
default描述内容
title标题内容

使用示例 ​

基础提示 ​

vue
<template>
  <FinAlert type="primary" title="分级阈值说明:" description="不同机构层级可设置不同的阈值要求。" />
</template>

可关闭的提示 ​

vue
<template>
  <FinAlert 
    type="warning" 
    title="警告提示" 
    closable 
    @close="handleClose" 
  />
</template>

<script setup>
function handleClose() {
  console.log('提示框已关闭')
}
</script>

使用插槽 ​

vue
<template>
  <FinAlert type="info">
    <template #title>
      <span style="font-weight: bold">自定义标题</span>
    </template>
    这里是通过默认插槽传入的描述内容,支持 <strong>HTML 标签</strong>。
  </FinAlert>
</template>

类型定义 ​

typescript
export type AlertType = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'error'

export interface FinAlertProps {
  type?: AlertType
  title?: string
  showIcon?: boolean
  closable?: boolean
  closeText?: string
  center?: boolean
  description?: string
  icon?: string
}

export type FinAlertEmits = {
  close: []
}