jiangchengfeiyi-xiaochengxu/uni_modules/zp-mixins/methods/getTabBar.js
2025-04-02 23:45:33 +08:00

20 lines
618 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 接管getTabBar函数默认uni-app是没有这个函数的
* 适用于使用custom-tab-bar自定义导航栏的小程序项目
* 需注意:
* 1.custom-tab-bar下面仍是小程序文件
* 2.pages.json里面需使用条件编译区分好小程序和非小程序的tabBar配置
*/
export function getTabBar() {
return {
setData(obj) {
if (typeof this.$mp?.page?.getTabBar === 'function' &&
this.$mp?.page?.getTabBar()) {
this.$mp.page.getTabBar().setData(obj)
} else {
console.log("当前平台不支持getTabBar(),已稍作处理,详细请参见相关文档。")
}
}
}
}