TreeviewCopyright © aleen42 all right reserved, powered by aleen42
提示信息 Toast Confirm
- 这里提供了轻提示和确认提示信息框的API,方便后续开发使用,风格与YB主体风格统一。
轻提示 Toast
- cb.utils.alert() API,可以显示成功、失败、警告类的提示;
示例
cb.utils.alert('接口信息返回有错误,请检查!', 'error');
参数说明:
- args0:提示文本
- args1:提示类型,success或fail-成功;error-失败;warning或info-警告
还有一种情况就是当参数为对象时的情况,具体示例如下:
cb.utils.alert({
title: '弹窗文本内容',
type: 'info',
duration: '3',
mask: true,
onClose: function(){
console.log('关闭后回调')
}
})
参数说明:
API | 含义 | 类型 | 取值 |
---|---|---|---|
title | 弹窗文本内容 | string | |
type | 弹窗类型 | string | 默认’info‘。可选 'error', 'fail', 'success', 'warning', 'info', 'noIcon' |
duration | 自动关闭的延时 | number | |
mask | 是否显示透明蒙层 | Boolean | true防止触摸穿透。false时不阻塞页面操作 |
onClose | 关闭后回调 | function |
确认提示 Confirm
- cb.utils.confirm() API,确认信息提示的弹窗;
示例
cb.utils.confirm('确定删除吗?', () => {
console.log('确定回调');
}, () => {
console.log('取消回调');
})
参数说明:
- args0:提示文本
- args1:确定按钮点击回调函数
- args2: 取消按钮点击回调函数
还有一种情况就是当参数为对象时的情况,具体示例如下:
cb.utils.confirm({
title: '弹窗标题',
message: '弹窗内容',
actions: [
{
text: '上传并下载',
onPress: () => { }
},{
text: '直接下载',
onPress: () => { }
},{
text: '取消',
onPress: () => { }
}
],
okFunc: () => {
console.log('确定回调')
},
cancelFunc: () => {
console.log('取消回调')
},
})
参数说明:
API | 含义 | 类型 | 取值 |
---|---|---|---|
title | 弹窗标题 | string | |
message | 弹窗内容 | string | |
actions | 自定义按钮组 | Array | {text, onPress, style}, 值为数组。不传该参数显示默认的确定取消。传 [] 则不显示操作按钮 |
okFunc | 确定回调 | function | |
cancelFunc | 取消回调 | function |