(1)页面跳转如何传值(实现跳转到不同页面)
点击页面
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
})
}
(2)小程序js中两个函数如何传值
Page({
data:{
navigateTitle:" ",
},
onLoad:function(options){
var category = options.category;
this.data.navigateTitle = category
},
onReady : function(event){
wx.setNavigationBarTitle({
title: this.data.navigateTitle
})
}
})