小程序 页面跳转如何传值
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
})
}
})