Get the App
SLTechnology News&Howtos  ›  Development  › 

What if wx.hideMenuItems is not effective in html5 development?

Shulou Source: shulou.com Published: 2022-06-01 13:01:40 09月17日 Update

This article is about how to use wx.hideMenuItems invalid in html5 development. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.

Solution: Put the wx.hideMenuItems() to be executed into wx.ready and it will take effect:

wx.config({ debug: true, //turn on debug mode, all api return values will be alerted on the client side, if you want to view the passed parameters, you can open it on the pc side, parameter information will be printed through log, only printed on the pc side. appId: '', //required, unique identifier of public number timestamp: , //required, timestamp of signature generation nonceStr: '', //required, random string of signature generation signature: '',//required, signature jsApiList: [] //required, JS interface list}); The ready method is executed after the// config message is verified. All interface calls must be performed after the config interface gets the result. Config is an asynchronous operation on the client side, so if you need to call the relevant interface when the page loads, you must put the relevant interface in the ready function to ensure correct execution. For interfaces that are called only when triggered by the user, they can be called directly without being placed in the ready function. wx.ready(function(){ //must be placed here to take effect wx.hideMenuItems( menuList: ['menuItem:share:appMessage'] );});/** Note: Wx.hideMenuItems() will not work if placed outside; */Thank you for reading! About "in html5 development using wx.hideMenuItems invalid how to do" This article is shared here, I hope the above content can be of some help to everyone, so that we can learn more knowledge, if you think the article is good, you can share it to let more people see it!

Tags: Interface what to do development information content functions parameters customers more articles generation good practical public client articles ways methods time identification Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL MariaDB NVidia Linux OPPO Reno