Taro 常用 API

Taro 常用 API 说明 网址
Taro.getSystemInfoSync() 获取系统信息同步接口。 https://nervjs.github.io/taro/docs/native-api.html#tarogetsysteminfosync
Taro.getCurrentPages(OBJECT) 使用方式同 getCurrentPages, 获取当前的页面栈,决定需要返回几层。 https://nervjs.github.io/taro/docs/native-api.html#tarogetcurrentpagesobject
Page.route 当前页面的路径,类型为String。 https://developers.weixin.qq.com/miniprogram/dev/reference/api/Page.html
Taro.createSelectorQuery() 返回一个 SelectorQuery 对象实例。可以在这个实例上使用 select 等方法选择节点,并使用 boundingClientRect 等方法选择需要查询的信息。 https://nervjs.github.io/taro/docs/native-api.html#tarocreateselectorquery
nodesRef.boundingClientRect([callback]) 添加节点的布局位置的查询请求,相对于显示区域,以像素为单位。其功能类似于 DOM 的 getBoundingClientRect。返回值是 nodesRef 对应的 selectorQuery。返回的节点信息中,每个节点的位置用 left、right、top、bottom、width、height 字段描述。如果提供了 callback 回调函数,在执行 selectQuery 的 exec 方法后,节点信息会在 callback 中返回。 https://nervjs.github.io/taro/docs/native-api.html#nodesrefboundingclientrect-callback
selectorQuery.exec([callback]) 执行所有的请求,请求结果按请求次序构成数组,在 callback 的第一个参数中返回。 https://nervjs.github.io/taro/docs/native-api.html#selectorqueryexec-callback
Taro.navigateTo(OBJECT) 使用方式同 wx.navigateTo,支持 Promise 化使用。 https://nervjs.github.io/taro/docs/native-api.html#taronavigatetoobject
Taro.getSetting(OBJECT) 获取用户的当前设置。返回值中只会出现小程序已经向用户请求过的权限。使用方式同 wx.getSetting,支持 Promise 化使用。 https://nervjs.github.io/taro/docs/native-api.html#tarogetsettingobject

posted on 2019-04-18 11:06  cag2050  阅读(918)  评论(0编辑  收藏  举报

导航