zoukankan      html  css  js  c++  java
  • toast

     start (e){
             wx.showToast({
            title: '轮播图',
            icon: 'success',
            duration: 2000
          })
        }

    wx.showToast(OBJECT)

    显示消息提示框
    OBJECT参数说明:
    参数 类型 必填 说明
    title String 提示的内容
    icon String 图标,只支持"success"、"loading"
    duration Number 提示的延迟时间,单位毫秒,默认:1500, 最大为10000
    success Function 接口调用成功的回调函数
    fail Function 接口调用失败的回调函数
    complete Function 接口调用结束的回调函数(调用成功、失败都会执行)
    示例代码:
    wx.showToast({
    title: '成功',
    icon: 'success',
    duration: 2000
    })

    wx.hideToast()

    隐藏消息提示框
    wx.showToast({
    title: '加载中',
    icon: 'loading',
    duration: 10000
    })

    setTimeout(function(){
    wx.hideToast()
    },2000)

    wx.showModal(OBJECT)

    显示模态弹窗
    OBJECT参数说明:
    参数 类型 必填 说明
    title String 提示的标题
    content String 提示的内容
    showCancel Boolean 是否显示取消按钮,默认为 true
    cancelText String 取消按钮的文字,默认为"取消",最多 4 个字符
    cancelColor HexColor 取消按钮的文字颜色,默认为"#000000"
    confirmText String 确定按钮的文字,默认为"确定",最多 4 个字符
    confirmColor HexColor 确定按钮的文字颜色,默认为"#3CC51F"
    success Function 接口调用成功的回调函数,返回res.confirm为true时,表示用户点击确定按钮
    fail Function 接口调用失败的回调函数
    complete Function 接口调用结束的回调函数(调用成功、失败都会执行)
    示例代码:
    wx.showModal({
    title: '提示',
    content: '这是一个模态弹窗',
    success: function(res) {
    if (res.confirm) {
    console.log('用户点击确定')
    }
    }
    })

    wx.showActionSheet(OBJECT)

    显示操作菜单
    OBJECT参数说明:
    参数 类型 必填 说明
    itemList String Array 按钮的文字数组,数组长度最大为6个
    itemColor HexColor 按钮的文字颜色,默认为"#000000"
    success Function 接口调用成功的回调函数,详见返回参数说明
    fail Function 接口调用失败的回调函数
    complete Function 接口调用结束的回调函数(调用成功、失败都会执行)
    success返回参数说明:
    参数 类型 说明
    cancel Boolean 用户是否取消选择
    tapIndex Number 用户点击的按钮,从上到下的顺序,从0开始
    示例代码:
    wx.showActionSheet({
      itemList: ['A', 'B', 'C'],
      success: function(res) {
        if (!res.cancel) {
          console.log(res.tapIndex)
        }
      }
    })
  • 相关阅读:
    Indexed DB入门导学(1)
    移动端touch事件封装
    javascript实现仿微信抢红包
    NODE学习:利用nodeJS去抓网页的信息
    ajax跨域请求无法携带cookie的问题
    四则运算
    wc
    我的问题
    css3新增加的属性
    css知识点回顾(一)
  • 原文地址:https://www.cnblogs.com/tian-sun/p/7405722.html
Copyright © 2011-2022 走看看