Skip to content

Commit

Permalink
feat(jd): 京东小程序添加 getTabBar 方法 (#14182)
Browse files Browse the repository at this point in the history
* feat: 京东小程序添加 getTabBar 方法

* test(snapshot): 更新测试快照

* test(snapshot): 更新测试快照

---------

Co-authored-by: xuanzebin <xuanzebin3@jd.com>
Co-authored-by: chenjiajian <798095202@qq.com>
  • Loading branch information
3 people authored Jul 21, 2023
1 parent e558f6d commit 4abd540
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/taro-jd/src/apis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@ declare const jd: any

export function initNativeApi (taro) {
processApis(taro, jd)

taro.getTabBar = function (pageCtx) {
if (typeof pageCtx?.getTabBar === 'function') {
return pageCtx.getTabBar()?.$taroInstances
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ require("./taro");
function useScope() {}
function initNativeApi(taro) {
processApis(taro, jd);
taro.getTabBar = function(pageCtx) {
var _a;
if (typeof (pageCtx === null || pageCtx === void 0 ? void 0 : pageCtx.getTabBar) === "function") {
return (_a = pageCtx.getTabBar()) === null || _a === void 0 ? void 0 : _a.$taroInstances;
}
};
}
var components = {
Swiper: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2839,6 +2839,12 @@ require("./runtime");
var taro_shared = "taro-shared-mock";
function initNativeApi(taro) {
processApis(taro, jd);
taro.getTabBar = function(pageCtx) {
var _a;
if (typeof (pageCtx === null || pageCtx === void 0 ? void 0 : pageCtx.getTabBar) === "function") {
return (_a = pageCtx.getTabBar()) === null || _a === void 0 ? void 0 : _a.$taroInstances;
}
};
}
var components = {
Swiper: {
Expand Down
2 changes: 1 addition & 1 deletion packages/taro/types/api/taro.extend.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ declare module '../index' {
setGlobalDataPlugin: setGlobalDataPlugin.Plugin

/** 获取自定义 TabBar 对应的 React 或 Vue 组件实例
* @supported weapp
* @supported weapp, jd
* @param page 小程序页面对象,可以通过 Taro.getCurrentInstance().page 获取
*/
getTabBar<T>(page: getCurrentInstance.Current['page']): T | undefined
Expand Down

0 comments on commit 4abd540

Please sign in to comment.