各端通用组件和API

每个端小程序所采用的框架和代码目录结构是一致的(点此查看小程序通用框架详细介绍)。另外基础组件和基础API在各端也保持一致(在交互和视觉样式上对不同端进行适配)。

基础组件

分类组件名称
视图容器View
Swiper
Scroll View
基础内容Text
Icon
Progress
表单组件Button
Form
Label
Input
Textarea
Radio
Checkbox
Switch
Slider
Picker View
Picker
导航Navigator
媒体组件Image
画布Canvas
地图Map
开放组件web-view

基础API


分类

API名称

网络

my.httpRequest



my.uploadFile



my.downloadFile

开放接口

my.getAuthCode(用户授权/免登)

导航栏

my.navigateTo



my.redirectTo



my.navigateBack



my.reLaunch



my.setNavigationBar

TabBar

my.switchTab

交互反馈

my.alert



my.confirm



my.showToast



my.showLoading



my.hideLoading



my.showActionSheet

下拉刷新

onPullDownRefresh



my.stopPullDownRefresh

选择日期

my.datePicker

动画

my.createAnimation

画布

my.createCanvasContext



toTempFilePath



setTextAlign



setTextBaseline



setFillStyle



setStrokeStyle



setShadow



createLinearGradient



createCircularGradient



addColorStop



setLineWidth



setLineCap



setLineJoin



setMiterLimit



rect



fillRect



strokeRect



clearRect



fill



stroke



beginPath



closePath



moveTo



lineTo



arc



bezierCurveTo



clip



quadraticCurveTo



scale



rotate



translate



setFontSize



fillText



drawImage



setGlobalAlpha



save



restore



draw

键盘

my.hideKeyboard

滚动

my.pageScrollTo

节点查询

my.createSelectorQuery



SelectorQuery



selectorQuery.select



selectorQuery.selectAll



selectorQuery.selectViewport



selectorQuery.boundingClientRect



selectorQuery.scrollOffset



selectorQuery.exec

分享

onShareAppMessage

位置

my.getLocation



my.openLocation

缓存

my.setStorage



my.setStorageSync



my.getStorage



my.getStorageSync



my.removeStorage



my.removeStorageSync

多媒体

图片



my.chooseImage



my.previewImage



my.saveImage



my.compressImage



my.getImageInfo

设备

系统信息



my.canIUse



my.getSystemInfo



my.getSystemInfoSync



网络状态



my.getNetworkType



剪贴板



my.getClipboard



my.setClipboard



振动



my.vibrate

蓝牙(钉钉端未支持)

my.openBluetoothAdapter



my.closeBluetoothAdapter



my.getBluetoothAdapterState



my.startBluetoothDevicesDiscovery



my.stopBluetoothDevicesDiscovery



my.getBluetoothDevices



my.getConnectedBluetoothDevices



my.connectBLEDevice



my.disconnectBLEDevice



my.writeBLECharacteristicValue



my.readBLECharacteristicValue



my.notifyBLECharacteristicValueChange



my.getBLEDeviceServices



my.getBLEDeviceCharacteristics



my.onBluetoothDeviceFound(callback)



my.offBluetoothDeviceFound



my.onBLECharacteristicValueChange(callback)



my.offBLECharacteristicValueChange



my.onBLEConnectionStateChanged(callback)



my.offBLEConnectionStateChanged



my.onBluetoothAdapterStateChange(callback)



my.offBluetoothAdapterStateChange

iBeacon(钉钉端未支持)

my.startBeaconDiscovery



my.stopBeaconDiscovery



my.getBeacons



my.onBeaconUpdate()



my.onBeaconServiceChange()

扫码

my.scan

原文: https://docs.alipay.com/mini/multi-platform/common