微信小程序 页面跳转传参的介绍

互联网 18-6-23
这篇文章主要介绍了微信小程序 页面跳转传参详解的相关资料,并附简单实例,和实现效果图,需要的朋友可以参考下

微信小程序 页面跳转传参,做微信小程序必定会用的这样的功能,这里就记录下本人学习实现代码资料。

<import src="../WXtemplate/headerTemplate.wxml"/>  <view>   <!--滚动图-->   <view>   <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoPlay}}" interval="{{intervalTime}}" duration="{{Time}}">   <block wx:for="{{imageURl}}">    <swiper-item>     <image src="{{item}}" class="imagePX"></image>    </swiper-item>   </block>   </swiper>   </view>   <!--功能按钮-->   <view class="section-bg">   <block wx:for="{{buttonNum}}">    <!--模版-->    <template is="buttonList" data="{{item}}"/>    <!--<view class="section-item">    <image class="section-img" src="{{item.image}}"></image>    <text class="section-text">{{item.text}}</text>   </view>-->   </block>   </view>   <!--资讯列表-->   <view>   <block wx:for="{{listNum}}">    <template is="newList" data="{{item,index}}"/>   </block>      </view>       </view>

其中

<template name="buttonList">   <view class="section-item">    <image class="section-img" src="{{item.image}}" bindtap="buttonClick"></image>    <text class="section-text">{{item.text}}</text>   </view>  </template>    <!--list-->  <template name="newList">   <view class="section-list" bindtap="listClick" id="{{index}}">   <view>    <image class="list-img" src="{{item.image}}"></image>   </view>      <view class="section-textt">    <view class="title"><text>{{item.title}}</text></view>    <view class="subTitle"><text>{{item.subTitle}}</text></view>   </view>   </view>    </template>
listClick:function(event){   console.log(event);   var p = event.currentTarget.id     wx.navigateTo({url:'/pages/xiangqing/xiangqing?id=上一页的参数'})   }

wx.navigateTo({url:'/pages/xiangqing/xiangqing?id=上一页的参数'})

listClick:function(event){   console.log(event);   var p = event.currentTarget.id     wx.navigateTo({url:'/pages/xiangqing/xiangqing?id='+p})   }
  data:{   // text:"这是一个页面"   title:''   },   onLoad:function(options){   // 页面初始化 options为页面跳转所带来的参数   this.setData({   title:options.id   })

<view>{{title}}</view>

以上就是本文的全部内容,希望对大家的学习有所帮助,更多相关内容请关注PHP中文网!

相关推荐:

微信小程序开发之实现选项卡的页面切换

微信小程序 页面跳转和数据传递

以上就是微信小程序 页面跳转传参的介绍的详细内容,更多内容请关注技术你好其它相关文章!

来源链接:
免责声明:
1.资讯内容不构成投资建议,投资者应独立决策并自行承担风险
2.本文版权归属原作所有,仅代表作者本人观点,不代表本站的观点或立场
上一篇:php获取远程图片并下载保存到本地的方法分析 下一篇:微信小程序开发之实现选项卡的页面切换

相关资讯