交互反馈

fund.showToast(OBJECT)

fund.showToast({
    title: 'toast',
    icon: 'success',
    duration: 1000
});
1
2
3
4
5

OBJECT参数说明

参数 类型 必填 说明
title String 提示的内容,长度与 icon 取值有关。
icon String 图标,有效值 "success", "loading", "none" 默认 "none"
image String 自定义图标的本地路径
mask Boolean 是否显示透明蒙层,防止触摸穿透,默认:false
duration Number 提示的延迟时间,单位毫秒,默认:1500
success Function 接口调用成功的回调函数
fail Function 接口调用失败的回调函数
complete Function 接口调用结束的回调函数(调用成功、失败都会执行)

icon 值说明

说明
none 不显示图标,此时 title 文本可显示两行 默认值。
success 显示成功图标,此时 title 文本最多显示 7 个汉字长度。
loading 显示加载图标,此时 title 文本最多显示 7 个汉字长度。

fail 返回参数说明

参数名 说明
errCode 错误代码
errMsg 错误描述

fund.hideToast()

隐藏消息提示框。

示例

fund.hideToast();
1

fund.showLoading(OBJECT)

显示 loading 提示框, 需主动调用 fund.hideLoading 才能关闭提示框。

OBJECT参数说明

参数 类型 必填 说明
title String 提示的内容
mask Boolean 是否显示透明蒙层,防止触摸穿透,默认:false
success Function 接口调用成功的回调函数
fail Function 接口调用失败的回调函数
complete Function 接口调用结束的回调函数(调用成功、失败都会执行)

示例

fund.showLoading({
    title: '加载中'
});
1
2
3

fund.hideLoading()

隐藏 loading 提示框。

示例

fund.showLoading({
    title: '加载中'
});

setTimeout(function () {
    fund.hideLoading();
}, 2000);
1
2
3
4
5
6
7

fund.showModal(OBJECT)

显示模态弹窗,类似于标准 html 的消息框:alert、confirm。

OBJECT参数说明

参数 类型 必填 说明
title String 提示的标题
content String 提示的内容
showCancel Boolean 是否显示取消按钮,默认为 true
cancelText String 取消按钮的文字,默认为"取消",最多 4 个字符
cancelColor HexColor 取消按钮的文字颜色,默认为"#000000"
confirmText String 确定按钮的文字,默认为"确定",最多 4 个字符
confirmColor HexColor 确定按钮的文字颜色,默认为"#3CC51F"
success Function 接口调用成功的回调函数
fail Function 接口调用失败的回调函数
complete Function 接口调用结束的回调函数(调用成功、失败都会执行)

success返回参数说明

参数 类型 说明
confirm Boolean 为 true 时,表示用户点击了确定按钮
cancel Boolean 为 true 时,表示用户点击了取消

示例

fund.showModal({
    title: '提示',
    content: '这是一个模态弹窗',
    success: function (res) {
        if (res.confirm) {
            console.log('用户点击确定');
        } else if (res.cancel) {
            console.log('用户点击取消');
        }
    }
});
1
2
3
4
5
6
7
8
9
10
11

fund.showActionSheet(OBJECT)

​显示操作菜单

OBJECT参数说明

参数 类型 必填 说明
itemList Array <String> 按钮的文字数组,数组长度最大为6个
title string 标题
itemColor Array <String> 按钮的文字颜色数组,不填时默认为"#000000"
cancelText String 取消按钮的文字,不填时默认为"取消"
cancelColor String 取消按钮的文字颜色,不填时默认为"#000000"
success Function 接口调用成功的回调函数,详见返回参数说明
fail Function 接口调用失败的回调函数
complete Function 接口调用结束的回调函数(调用成功、失败都会执行)

success返回参数说明

参数 类型 说明
tapIndex Number 用户点击的按钮,从上到下的顺序,从0开始

示例

fund.showActionSheet({
    itemList: ['A', 'B', 'C'],
    itemColor: ['#ff0000','#00ff00','#0000ff'],
    title: '标题',
    cancelText: '关闭',
    cancelColor: '#666666',
    success: function (res) {
        console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
    },
    fail: function (res) {
        console.log(res.errMsg);
    }
});
1
2
3
4
5
6
7
8
9
10
11
12
13
Last Updated: 7/10/2019, 4:43:36 PM