應用場景:如剛進入小程序授權功能用戶選擇退出、或用戶沒有權限訪問讓其退出小程序。
解決方案:微信小程序並沒有直接提供直接退出小程序的api,但在小程序2.1.0版本後,支持navigator組件進行退出:
代碼:index.html
<navigator hover-class="none" target="miniProgram" open-type="exit"> 退出當前小程序</navigator>
一行搞定。
注意:版本、版本、版本。
應用場景:如剛進入小程序授權功能用戶選擇退出、或用戶沒有權限訪問讓其退出小程序。
解決方案:微信小程序並沒有直接提供直接退出小程序的api,但在小程序2.1.0版本後,支持navigator組件進行退出:
代碼:index.html
<navigator hover-class="none" target="miniProgram" open-type="exit"> 退出當前小程序</navigator>
一行搞定。
注意:版本、版本、版本。
Component({ behaviors: [], // 屬性定義(詳情參見下文) properties: { myProperty: { // 屬性名 type: String,