微信小程序比起WEB来虽然能力上受到一些限制,但也具备WEB没用的原生能力,下面罗列一些常用的原生接口,具体查看小程序官方文档。
wx.getDeviceInfo(); log($r)
wx.getSystemInfoSync(); log($r)
或 wx.getSystemInfo({ success: func("log($arg)") })
wx.showActionSheet({ itemList: ["A", "B", "C"], success: func("log($arg.tapIndex)") })
wx.downloadFile({ url: "https://a.zccdn.cn/l/6344dce1f18cdeb21c08615f.pdf", success: func("wx.openDocument({ filePath: $arg.tempFilePath })") })
wx.showNavigationBarLoading()
和 wx.hideNavigationBarLoading()
wx.startPullDownRefresh()
和 wx.stopPullDownRefresh()
wx.scanCode({ success: func("log($arg)") })
wx.sendSms({ phoneNumber: $c.me.phone, content: "xxxxxxxx" })
wx.vibrateShort({ type: "heavy" })
wx.vibrateLong()