更新记录

1.0.0(2026-08-12) 下载此版本

首次发布:提供双向显示状态、遮罩关闭、确认和取消事件。


平台兼容性

AI 提示弹窗

组件名:ai-alert

零依赖的 uni-app 确认提示弹窗,适用于删除确认、退出确认和操作提示等场景。

安装

从插件市场导入后保留 uni_modules/ai-alert。项目开启 easycom 时可直接使用;否则手动导入:

import AiAlert from '@/uni_modules/ai-alert/components/ai-alert/ai-alert.vue'

使用

<template>
  <view>
    <button @click="visible = true">删除</button>
    <ai-alert
      :visible.sync="visible"
      title="删除内容"
      content="删除后无法恢复,确认继续吗?"
      confirm-text="删除"
      :mask-closable="true"
      @confirm="handleConfirm"
      @cancel="handleCancel"
      @close="handleClose"
    />
  </view>
</template>

<script>
export default {
  data() {
    return { visible: false }
  },
  methods: {
    handleConfirm() {
      // 执行确认操作
    },
    handleCancel() {
      // 用户点击取消
    },
    handleClose() {
      // 所有关闭方式都会触发
    }
  }
}
</script>

属性

属性 类型 默认值 说明
visible Boolean false 是否显示,支持 .sync
title String 提示 标题
content String '' 内容
cancelText String 取消 取消按钮文字
confirmText String 确认 确认按钮文字
maskClosable Boolean false 点击遮罩时是否关闭

事件与方法

  • confirm:点击确认后触发。
  • cancel:点击取消后触发。
  • close:通过确认、取消、遮罩或 hide() 关闭时触发,参数为关闭原因。
  • show():通过 ref 请求显示弹窗。
  • hide():通过 ref 请求关闭弹窗。

平台

支持 Vue 2 的微信小程序、App-Vue 与 H5,无第三方依赖;不支持 nvue 和 Vue 3。

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不采集任何数据

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT License

Copyright (c) 2026

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

暂无用户评论。