国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

微信小程序商品到詳情的實現

2019-11-19 16:14:38
字體:
來源:轉載
供稿:網友

微信小程序商品到詳情結構代碼資源分享給大家.

商品頁

post.wxmldata-postid="{{index}}view class="container" swiper indicator-dots indicator-color="rgba(255,255,255,0.3)" indicator-active-color="rgba(255,255,255,1)" autoplay swiper-item image src= ...

商品頁 post.wxml

data-postid="{{index}} <view class="container"><swiper indicator-dots indicator-color="rgba(255,255,255,0.3)" indicator-active-color="rgba(255,255,255,1)" autoplay><swiper-item><image src="/dist/images/wx.png"></image></swiper-item><swiper-item><image src="/dist/images/vr.png"></image></swiper-item><swiper-item><image src="/dist/images/iqiyi.png"></image></swiper-item></swiper><view class="article-list"><view class="article" wx:for="{{postList}}" wx:for-item="article" wx:key="index" catchtap="goDetail" data-postid="{{index}}"><view class="article-author-date"><image src="{{article.avatar}}" class="article-author"></image><text class="article-date">{{article.date}}</text></view><text class="article-title">{{article.title}}</text><image src="{{article.imgSrc}}" class="article-image"></image><text class="article-content">{{article.content}}</text><view class="article-link"><image src="/dist/images/icon/chat1.png"></image><text>{{article.collection}}</text><image src="/dist/images/icon/view.png"></image><text>{{article.reading}}</text></view></view></view></view>

post.js

en對象獲取postid

var postData = require ("../../data/posts-data.js");Page({onLoad:function(){this.setData({postList:postData.postList})}, goDetail:function(en){ var postid = en.currentTarget.dataset.postid;wx.navigateTo({url:"post-detail/post-detail?postId="+postid})}})

商品詳情頁 post-detail.js

用option接收postid 

var postData = require("../../../data/posts-data.js");Page({onLoad:function(option){console.log(option);}})

感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 武冈市| 揭阳市| 称多县| 塔河县| 兴城市| 依安县| 寿宁县| 泉州市| 棋牌| 通江县| 报价| 驻马店市| 宁夏| 香格里拉县| 上栗县| 库车县| 隆回县| 兰考县| 竹北市| 阿鲁科尔沁旗| 蒙阴县| 会宁县| 兖州市| 陆良县| 横山县| 镇安县| 南靖县| 新源县| 随州市| 龙海市| 渭南市| 合肥市| 昭苏县| 宁武县| 开远市| 阿拉善右旗| 福贡县| 清新县| 庆阳市| 柳江县| 辉南县|