最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

微信小程序頁(yè)面?zhèn)鞫鄠€(gè)參數(shù)跳轉(zhuǎn)頁(yè)面的實(shí)現(xiàn)方法

 更新時(shí)間:2019年05月17日 09:57:14   作者:online-oliver  
這篇文章主要介紹了微信小程序頁(yè)面?zhèn)鞫鄠€(gè)參數(shù)跳轉(zhuǎn)頁(yè)面的實(shí)現(xiàn)方法,本文圖文并茂給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

這里舉例跳轉(zhuǎn)兩個(gè)參數(shù) 傳遞多少個(gè)也可以

這里傳參數(shù) 我寫作 data-item data-id 來(lái)綁定 同事加了點(diǎn)擊事件bindtap

在index.js

在 data 里我寫的是假數(shù)據(jù)

在跳轉(zhuǎn)頁(yè)面的函數(shù)里傳e 后面定義的東西根據(jù)e來(lái)確定 可以在console打印

console.log(e)

這樣我們就拿到了 傳遞的數(shù)據(jù) 然后進(jìn)行定義等

這里跳轉(zhuǎn)詳情頁(yè)的函數(shù) wx.navigateTo 這是一種跳轉(zhuǎn)的方法 tabBar頁(yè)面要用wx.switchTab 路徑后面加上 jsonStr 等

在跳轉(zhuǎn)的詳情頁(yè)面的onload方法里面寫

我們打印上個(gè)頁(yè)面?zhèn)魅氲臄?shù)據(jù)

打印出上個(gè)頁(yè)面?zhèn)魅氲臄?shù)據(jù) 在進(jìn)行that.setData 就行了

wxml:

<view class='fast-container'>
 <block wx:for="{{fast}}" wx:key="fast">
  <view class='fast-row' bindtap='goIndexDetail' data-item="{{item}}" data-id="{{list}}">
    <view class='row-tou'>
      <image class='img' src='{{item.image}}'></image>
    </view>
    <view class='row-content'>
     <view class='text'>{{item.name}}</view>
     <view class='content'>{{item.summary}}</view>
    </view>
  </view>
 </block>
</view>

index.js

Page({
 /**
  * 頁(yè)面的初始數(shù)據(jù)
  */
 data: {
  fast:[ //假數(shù)據(jù)
   { 'name': 'red', 'image': '/img/123.jpg','summary':'我是紅色'},
   { 'name': 'green', 'image': '/img/123.jpg', 'summary': '我是綠色' },
   { 'name': 'blue', 'image': '/img/123.jpg', 'summary': '我是藍(lán)色' },
   { 'name': 'orange', 'image': '/img/123.jpg', 'summary': '我是橘色' }
  ],
  list:[ //假數(shù)據(jù)
   {'content':'content-red'},
   { 'content': 'content-green' },
   { 'content': 'content-blue' },
   { 'content': 'content-orange' }   
  ]
 },
 // ----跳轉(zhuǎn)詳情頁(yè)
 goIndexDetail : function (e) {
  // console.log('我要傳入的值e+++',e)
  let id = e.currentTarget.dataset.id;
  let item = e.currentTarget.dataset.item;
  console.log('我傳入的data-id+',id,'我傳入的data-item=',item)
  let str = JSON.stringify(id);
  let _str = JSON.stringify(item)
  wx.navigateTo({
   url: '/pages/index/indexDetail/indexDetail?jsonStr=' + str + "&strr=" + _str,
  })
 },
 /**
  * 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面加載
  */
 onLoad: function (options) {
 },
 /**
  * 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面初次渲染完成
  */
 onReady: function () {
 },
 /**
  * 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面顯示
  */
 onShow: function () {
 },
 /**
  * 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面隱藏
  */
 onHide: function () {
 },
 /**
  * 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面卸載
  */
 onUnload: function () {
 },
 /**
  * 頁(yè)面相關(guān)事件處理函數(shù)--監(jiān)聽(tīng)用戶下拉動(dòng)作
  */
 onPullDownRefresh: function () {
 },
 /**
  * 頁(yè)面上拉觸底事件的處理函數(shù)
  */
 onReachBottom: function () {
 },
 /**
  * 用戶點(diǎn)擊右上角分享
  */
 onShareAppMessage: function () {
 }
})

indexDetail.js

Page({
 /**
  * 頁(yè)面的初始數(shù)據(jù)
  */
 data: {
  detail: [],
  detailList,
 },
 /**
  * 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面加載
  */
 onLoad: function (options) {
  let that = this
  // console.log(options)
  // console.log(options.jsonStr)
  // console.log(options.strr)
  let item = JSON.parse(options.jsonStr)
  let id = JSON.parse(options.strr)
  console.log('上個(gè)頁(yè)面跳轉(zhuǎn)的data-item++', item)
  console.log('上個(gè)頁(yè)面跳轉(zhuǎn)的data-id++', id)
  that.setData({
   detail: id,
   detailList: item
  })
 },
 /**
  * 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面初次渲染完成
  */
 onReady: function () {
 },
 /**
  * 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面顯示
  */
 onShow: function () {
 },
 /**
  * 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面隱藏
  */
 onHide: function () {
 },
 /**
  * 生命周期函數(shù)--監(jiān)聽(tīng)頁(yè)面卸載
  */
 onUnload: function () {
 },
 /**
  * 頁(yè)面相關(guān)事件處理函數(shù)--監(jiān)聽(tīng)用戶下拉動(dòng)作
  */
 onPullDownRefresh: function () {
 },
 /**
  * 頁(yè)面上拉觸底事件的處理函數(shù)
  */
 onReachBottom: function () {
 },
 /**
  * 用戶點(diǎn)擊右上角分享
  */
 onShareAppMessage: function () {
 }
})

總結(jié)

以上所述是小編給大家介紹的微信小程序頁(yè)面?zhèn)鞫鄠€(gè)參數(shù)跳轉(zhuǎn)頁(yè)面的實(shí)現(xiàn)方法,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
如果你覺(jué)得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!

相關(guān)文章

最新評(píng)論

鹤壁市| 德阳市| 汉阴县| 禹州市| 米林县| 巧家县| 香格里拉县| 衡阳县| 什邡市| 德保县| 衡阳县| 栖霞市| 容城县| 依兰县| 洮南市| 河池市| 西峡县| 汝阳县| 凤冈县| 镶黄旗| 望城县| 中阳县| 天长市| 宁夏| 华阴市| 姜堰市| 潜山县| 屏南县| 两当县| 乌兰察布市| 苗栗县| 新巴尔虎右旗| 闵行区| 灵宝市| 龙里县| 陇西县| 济宁市| 剑阁县| 永福县| 白朗县| 房产|