JSAPI Reference

UI

Component NameFunction Description
my.setNavigationBarSet the navigation bar text and style.
my.showNavigationBarLoadingShow navigation bar loading.
my.hideNavigationBarLoadingHide navigation bar loading.

TabBar

Component NameFunction Description
my.hideTabBarHide the tabBar.

Route

Component NameFunction Description
my.switchTabJump to the specified tabBar page and close all other pages that are not tabBar.
my.navigateToMaintain the current page and jump to the specified page within the application. Use my.navigateBackto return to the original page.
my.reLaunchClose all current pages and jump to the specified page within the application.
my.navigateBackClose the current page and return to the previous one or more pages.
my.redirectToClose the current page and jump to the specified page within the application.

FeedBack

Component NameFunction Description
my.alertAlert box
my.confirmConfirm box
my.promptPromat box
my.showToastShow a weak hint, which disappears in the specified seconds.
my.hideLoadingHide the loading hint.
my.hideToastHide the weak hint
my.showLoadingShow the loading hint.

Pulldown

Component NameFunction Description
onPullDownRefreshOn the Page, customize the onPullDownRefresh function to listen to the pull-to-refresh event of user.
my.stopPullDownRefreshStop the pull-to-refresh for the current page.
my.startPullDownRefreshStart the pull-to-refresh function.

Contact

Component NameFunction Description
my.choosePhoneContactChoose contact from system contact.

Animation

Component NameFunction Description
my.createAnimationCreate an instance of animation.

Canvas

Component NameFunction Description
my.createCanvasContextCreate the context of the canvas.

Keyboard

Component NameFunction Description
my.hideKeyboardHide keyboard.

Scoll

Component NameFunction Description
my.pageScrollToScroll to the destination location of the page.

SelectorQuery

Component NameFunction Description
my.createSelectorQueryCreate an instance of SelectorQuery.

Multiple Level Select

Component NameFunction Description
my.multiLevelSelectMultiple level selector, used for associated select with multiple levels.

Set Background

Component NameFunction Description
my.setBackgroundColorSet background color.

Set Page Pulldown

Component NameFunction Description
my.setCanPullDownSet whether page can support pulldown.

Media

Image

Component NameFunction Description
my.chooseImageChoose image from camera or album of cellphone.
my.previewImagePreview image.
my.saveImageSave the online images to cellphone album.
my.getImageInfoGet the information of the image.

Storage

Component NameFunction Description
my.setStorageStore the data in the specified key in the local cache, which overlaps the original data corresponding to the key.
my.setStorageSyncStore synchronously the data in the specified key in the local cache.
my.getStorageGet cached data
my.getStorageSyncGet cached data synchronously.
my.removeStorageRemove cached data.
my.removeStorageSyncRemove cached data synchronously.
my.clearStorageClear local data cache.
my.clearStorageSyncClear local data cache synchronously.

File

Component NameFunction Description
my.saveFileSave file to the device.
my.getFileInfoGet the information of the file.
my.getSavedFileInfoGet the information of the saved file.
my.getSavedFileListGet the information of all the saved file.
my.removeSavedFileRemove the saved file.

Location

Component NameFunction Description
my.getLocationget the current geographical location of the user.

Network

Component NameFunction Description
my.requestNetwork request
my.uploadFileUpload the local resource to the developer server.
my.downloadFileDownload file resource to local location.

Device

canIUse

Component NameFunction Description
my.canIUseJudge whether the current Mini Program API, incoming parameter or return value, component, attribute, etc. are supported in the current version.

SDKVersion

Component NameFunction Description
my.SDKVersionGet the SDK version.

System Information

Component NameFunction Description
my.getSystemInfoGet system information

Network Status

Component NameFunction Description
my.getNetworkTypeGet the current network status.

Clipboard

Component NameFunction Description
my.getClipboardGet the clipboard data.
my.setClipboardSet the clipboard data.

Vibrate

Component NameFunction Description
my.vibrateInvoke the vibrate ability of device.

Make Phone Call

Component NameFunction Description
my.makePhoneCallMake a phone.

Get Server Time

Component NameFunction Description
my.getServerTimeGet the server time.

Capture Screen

Component NameFunction Description
my.onUserCaptureScreenListen to the capture screen event by users.
my.offUserCaptureScreenCancel the listen to the capture screen event by users.

Screen Brightness

Component NameFunction Description
my.setKeepScreenOnSet whether screen keeps awake.
my.getScreenBrightnessGet the screen brightness.
my.setScreenBrightnessSet the screen brightness.

Add Phone Contact

Component NameFunction Description
my.addPhoneContactAdd contact to phone contact.

Permission Guide

Component NameFunction Description
my.showAuthGuideGuide user to grant the authorization when the permission needed.

Scan

Component NameFunction Description
my.scanCall the scanning QR code function.

web-view

Component NameFunction Description
my.createWebViewContextBy creating webViewContext, Mini Program can send message to web-view. This API will create a webViewContext instance

Open Capabilities

Component NameFunction Description
my.getAuthCodeGet auth code.
my.getOpenUserInfoGet basic information about user.
my.tradePayStart to pay.
my.navigateToMiniProgramJump to other Mini Program.
my.navigateBackMiniProgramReturn to the previous Mini Program, only when another Mini Program jumps to the current Mini Program.