diff --git a/docs/uniCloud/uni-push/starter.md b/docs/uniCloud/uni-push/starter.md index be62484e7b591cf3e1cb4a91a0bfad48a9b9b465..a2b4289d89072bc459c0142b8d319a5e35bc7e2e 100644 --- a/docs/uniCloud/uni-push/starter.md +++ b/docs/uniCloud/uni-push/starter.md @@ -92,14 +92,24 @@ uni-push2.0需è¦å¼€å‘者开通uniCloud。ä¸ç®¡æ‚¨çš„业务æœåŠ¡å™¨æ˜¯å¦ä½¿ }) ``` -### 监å¬æŽ¨é€æ¶ˆæ¯ - -åœ¨é¡¹ç›®æ ¹ç›®å½•çš„App.vueçš„onLaunch生命周期ä¸æ·»åŠ 代ç 示例: - +### 监å¬æŽ¨é€æ¶ˆæ¯@listener +监å¬æŽ¨é€æ¶ˆæ¯çš„代ç ,应当写在应用生命周期(å³ï¼šé¡¹ç›®æ ¹ç›®å½•çš„App.vueæ–‡ä»¶ï¼‰ä¸ +示例代ç : ```js -uni.onPushMessage((res)=>{ - console.log(res)//监å¬æŽ¨é€æ¶ˆæ¯ -}) +export default { + onLaunch: function() { + console.log('App Launch') + uni.onPushMessage((res)=>{ + console.log(res)//监å¬æŽ¨é€æ¶ˆæ¯ + }) + }, + onShow: function() { + console.log('App Show') + }, + onHide: function() { + console.log('App Hide') + } +} ``` **APP端真机è¿è¡Œæ³¨æ„:** 如果å¯ç”¨äº†ç¦»çº¿æŽ¨é€ï¼Œå¿…须:ç»è¿‡å‘行原生app云打包åŽï¼Œå®¢æˆ·ç«¯æ‰èƒ½ç›‘å¬åˆ°æŽ¨é€æ¶ˆæ¯ã€‚