微信小程序的跳转及传参

1、微信小程序的跳转

 方法(1)

<wxml>   
<button bindtap="goIndex">goIndex</button>
<js>
goIndex(){ wx.navigateTo({ url:'../index/index', success:function(res){}, fail:function(res){}, complete:function(res){}, }) }

 方法(2)

<wxml>
<navigator type="navigator " url='../index/index'>to</navigator >

  2、bindtap 传参

<wxml>
<view class="item" bindtap="goIndex" data-index='{{jId}}'>

  

<JS>
goIndex(e){ const index=e.currentTarget.dataset.index||e.target.dataset.index }

  

原文地址:https://www.cnblogs.com/keai/p/11078155.html