微信小程序—頁面跳轉

問題:html

  實現頁面跳轉:index頁面經過按鈕跳轉到next頁面小程序

方法:api

  一、頁面index.wxml增長一個按鈕  函數

1 // index.wxml
2 <button bindtap="jump">跳轉</button>

  二、在index.js中添加跳轉邏輯url

1 // 調轉函數
2 jump: function () { 3  wx.navigateTo({ 4       url: "../next/next"
5  }) 6 },

  三、重點:spa

    button 表單組件:官方連接:https://developers.weixin.qq.com/miniprogram/dev/component/button.htmlcode

      bindtap  :在組件中綁定一個事件處理函數component

    wx.navigateTo(Object object)  :官方連接:https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateTo.htmlxml

      保留當前頁面,跳轉到應用內的某個頁面。可是不能跳到 tabbar 頁面。使用 wx.navigateBack 能夠返回到原頁面。小程序中頁面棧最多十層htm

相關文章
相關標籤/搜索