小程序 · wx.showActionSheet在安卓无取消按键

484 阅读1分钟

用的mpvue开发,原生开发和其他框架同理

app.vue中获取手机系统 platform

  getSystemInfo() {
    wx.getSystemInfo({
      success: e => {
        console.log(e.platform)
        this.$store.commit('setPlatform', e.platform)
      }
    })
  },

使用wx.showActionSheet时,如果是 android,在itemList后push 取消 按键:

  if (this.$store.state.platform === 'android') {
    itemList.push('取消')
  }