本文给大家带来的是微信小程序酱酒小百科图文列表设计制作开发教程,制作好以后效果图如下:
一、wxml页面代码如下:
<!--pages/index/knowledgeList.wxml-->
<view class="container">
<navigator wx:for="{{news}}" url="knowledgeDetail?id={{item.id}}" class="newlist" hover-class="weui-cell_active">
<view class="newslist-left"><image src="{{item.img}}"></image></view>
<view class="newslist-right font-size-333">{{item.title}}</view>
</navigator>
</view>
|
二、wxss样式文件代码如下:
/* pages/index/knowledgeList.wxss */
.newlist{
background-color: #ffffff;
height: 120rpx;
display: flex;
flex-direction: row;
padding: 30rpx;
align-items: center;
margin-top: 20rpx;
}
.newslist-left image{
width: 160rpx;
height: 120rpx;
margin-right: 30rpx;
}
|
三、js页面代码如下:
// pages/index/knowledgeList.js
Page({
data:{
news:[{
id:1,
title:"酱香白酒与健康的“理论方程式”",
img:"/assets/testimages/timg.jpg"
},{
id:2,
title:"酱香白酒与健康的“理论方程式”",
img:"/assets/testimages/timg.jpg"
},{
id:3,
title:"酱香白酒与健康的“理论方程式”",
img:"/assets/testimages/timg.jpg"
}]
},
onLoad:function(options){
// 页面初始化 options为页面跳转所带来的参数
},
onReady:function(){
// 页面渲染完成
},
onShow:function(){
// 页面显示
},
onHide:function(){
// 页面隐藏
},
onUnload:function(){
// 页面关闭
}
})
|