mpvue develop micro-channel applet share button given: `Can not read property 'apply' of null`

With the development of micro-channel mpvue small program error share button:Cannot read property 'apply' of null

onShareAppMessage is a micro letter Pages applet lifecycle hook, this method can not be written Gu methods里

 

Examples of life cycle

Vue same, except that we will be in a small program onReady, go trigger vue mounted lifecycle, a detailed look at the document life cycle vue lifecycle hook

  • beforeCreate
  • created
  • beforeMount
  • mounted
  • beforeUpdate
  • updated
  • activated
  • deactivated
  • beforeDestroy
  • destroyed

In addition to the Vue's own life cycle, mpvue also compatible with a small program life cycle, this part of the life cycle of the hook from Page small micro-channel programs , except in special circumstances, we do not recommend the use of life-cycle hook applet.

app section:

  • onLaunch, initialization
  • onShow, when the applet is started, or from the background into the foreground display
  • onHide, when the applet from the foreground into the background

page section:

  • onLoad, monitor page load
  • onShow, page display monitor
  • onReady, listening initial page rendering is complete
  • onHide, monitor page Hide
  • onUnload, monitor page unload
  • onPullDownRefresh, drop-down monitor user actions
  • onReachBottom, pull the bottom of the page event handler
  • onShareAppMessage, the user clicks on the top right corner to share
  • onPageScroll, page scrolling
  • onTabItemTap, the current tab page is triggered (mpvue 0.0.16 support) when clicked tab

Guess you like

Origin www.cnblogs.com/buerwei/p/10931704.html