小程序 页面跳转如何传值

WXML:加入自定义属性(data-category=”{{categoryTitle}}”)

 <view class="more" catchtap="onMoreTap" data-category="{{categoryTitle}}">

js:在event中取出category值并加到URL中

onMoreTap:function(event){
      var category=event.currentTarget.dateset.category;
      wx.navigateTo({
         url:"more-movie/more-movie?category="+category
      })
  }

小程序js中两个函数如何传值

Page({
  data:{
    navigateTitle:" ",
  },
  onLoad:function(options){
     var category = options.category;
     this.data.navigateTitle = category
  },
  onReady : function(event){
    wx.setNavigationBarTitle({
       title: this.data.navigateTitle
     })
  }
})

转自:https://www.jianshu.com/p/e94cb6c323f4

猜你喜欢

转载自blog.csdn.net/weixin_35773751/article/details/80269741