运维平台提示wx.hideTabBar not a function
发布于 7 年前 作者 qyan 5695 次浏览 来自 问答

wx.hideTabBar is not a function;at pages/index/index page lifeCycleMethod onShow function

wx.showTabBar is not a function;at pages/index/index setIsLogined function;at api request success callback function

代码片段:

wywx.js文件

function hideTabBar(success, fail) {

 wx.hideTabBar({

   aniamtion: false,

   success: typeof success == “function” ? success() : function (res) {

     console.log(“wx.hideTabBar.success”);

   },

   fail: typeof fail == “function” ? fail() : function (res) {

     console.log(“wx.hideTabBar.fail”);

   },

   complete: function (res) { },

 })

}

function showTabBar(success, fail) {

 wx.showTabBar({

   aniamtion: false,

   success: typeof success == “function” ? success() : function (res) {

     console.log(“wx.showTabBar.success”);

   },

   fail: typeof fail == “function” ? fail() : function (res) {

     console.log(“wx.showTabBar.fail”);

   },

   complete: function (res) { },

 });

}

index.js文件中调用

var w = require("…/…/utils/mywx.js");

w.showTabBar(function () {

       console.log(“w.showTabBar”)

});

w.hideTabBar();

1 回复

你好,基础库1.9.0开始支持

回到顶部