微信小程序的跳转及传参

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 }

  

posted @ 2019-06-24 17:08  甜甜的小可爱ha  阅读(229)  评论(0编辑  收藏  举报