# 界面交互

# wx.showModal

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

# wx.showLoading (opens new window)

# wx.showToast (opens new window)

以 Promise 风格 (opens new window) 调用:支持

wx.showToast({
  title: '成功',
  icon: 'success',
  duration: 2000
})
1
2
3
4
5
image-20211130105643937

# wx.showActionSheet (opens new window)

wx.showActionSheet({
  itemList: ['A', 'B', 'C'],
  success (res) {
    console.log(res.tapIndex)
  },
  fail (res) {
    console.log(res.errMsg)
  }
})
1
2
3
4
5
6
7
8
9
image-20211130135121092

# 数据存储