alert
alert 警告框
支持
安装
$ npm install @uni/alert --save
示例
import alert from '@uni/alert';
alert({
title: 'alert框的标题',
content: 'alert框的内容',
buttonText: '按钮文字,默认confirm'
}).then(() => {
console.log('确定');
});
你也可以从大包引入:
import { alert } from '@uni/apis';
参数
成员 | 类型 | 描述 | 默认值 |
---|---|---|---|
options | object |
alert 参数 | - |
options.content | string |
alert 内容 | - |
options.title | string |
alert 标题 | - |
options.buttonText | string |
alert 确认按钮文字 | - |
不通用参数(由于破坏了一码多端的能力,请谨慎使用)
成员 | 类型 | 描述 | 默认值 | 支持 |
---|---|---|---|---|
options.confirmColor | string |
alert 确认按钮颜色 | - |
注意
部分选项仅微信小程序支持,如 confirmColor
等。用户可直接在 options 中传入,但是不会在其他小程序端生效。