1. 表示操作成功,文字上方会显示一个表示操作成功的图标。
    小程序弹窗 - 图1

    1. wx.showToast({
    2. title: '操作成功!', // 标题
    3. icon: 'success', // 图标类型,默认success
    4. duration: 1500 // 提示窗停留时间,默认1500ms
    5. })

    2.表示加载中,显示为加载中图标。
    小程序弹窗 - 图2

    1. wx.showToast({
    2. title: '加载中...',
    3. icon: 'loading',
    4. duration: 1500
    5. })

    3.不显示图标,一般用作提示。
    小程序弹窗 - 图3

    1. wx.showToast({
    2. title: '该功能未上线!',
    3. icon: 'none',
    4. duration: 1500
    5. })

    以上3种弹窗均使用wx.showToast接口,调用后会根据设定的duration停留一定时间。
    此外,表示加载中的弹窗还可以使用wx.showLoading接口,但调用该接口时弹窗并不会自动消失,而是需要手动调用wx.hideLoading接口使弹窗消失。

    1. // 开始加载数据
    2. wx.showLoading({
    3. title: '加载中',
    4. })
    5. // 数据加载中... // 数据加载中...
    6. // 数据加载完成,隐藏弹窗
    7. wx.hideLoading()