微信小程序商品到詳情的實現
更新時間:2017年06月27日 09:38:13 投稿:lqh
這篇文章主要介紹了微信小程序商品到詳情的實現的相關資料,需要的朋友可以參考下
微信小程序商品到詳情結構代碼資源分享給大家.
商品頁
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); } })
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
相關文章
lodash內部方法getFuncName及setToString剖析詳解
本篇章我們主要是通過了解lodash里的兩個內部方法getFuncName方法和setToString方法,在實際開發(fā)中我們也可以借鑒方法的實現思路,在需要的時候簡單封裝一下,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2022-09-09超越Node.js的JavaScript運行環(huán)境Bun.js功能特性詳解
這篇文章主要為大家介紹了超越Node.js的JavaScript運行環(huán)境Bun.js功能特性詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-09-09Web?Components實現類Element?UI中的Card卡片
這篇文章主要為大家介紹了Web?Components實現類Element?UI中的Card卡片實例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2022-07-07package.json中browser?module?main字段優(yōu)先級對比
這篇文章主要介紹了package.json中browser?module?main字段的優(yōu)先級詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-07-07小程序開發(fā)踩坑:頁面窗口定位(相對于瀏覽器定位)(推薦)
這篇文章主要介紹了小程序開發(fā)頁面窗口定位,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2019-04-04