WeChat Mini Program API Interaction Feedback


wx.showToast(OBJECT)

WeChat applet displays message prompt box

OBJECT parameter description:

QQ截图20170208131632.png

Sample code:

wx.showToast({
  title: '成功',
  icon: 'success',
  duration: 2000
})

wx.hideToast()

Hide message prompt box

wx.showToast({
  title: '加载中',
  icon: 'loading',
  duration: 10000
})

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

wx.showModal(OBJECT)

WeChat applet displays modal pop-up window

OBJECT parameter description:

QQ截图20170208131651.png

Sample code:

wx.showModal({
  title: '提示',
  content: '这是一个模态弹窗',
  success: function(res) {
    if (res.confirm) {
      console.log('用户点击确定')
    }
  }
})

wx.showActionSheet(OBJECT)

WeChat applet display Operation menu

OBJECT parameter description:

QQ截图20170208131711.png

success return parameter description:

QQ截图20170208131723.png

Sample code:

wx.showActionSheet({
  itemList: ['A', 'B', 'C'],
  success: function(res) {
    if (!res.cancel) {
      console.log(res.tapIndex)
    }
  }
})

Bug & Tip

  1. bug: Android 6.3.30, returned by wx.showModal confirm is always true;