本文给大家带来的是微信小程序个人书单读书记录列表页面样式设计制作开发教程,制作好以后效果图如下:
一、wxml页面代码如下:
<!--bookList.wxml-->
<import src="list/list-template.wxml" />
<view class="container">
<block wx:for="{{bookList}}">
<template is="list" data="{{...item}}"></template>
</block>
</view>
|
二、wxss样式文件代码如下:
/* bookList.wxss */
@import "list/list-template.wxss";
.container{
display: flex;
flex-direction: column;
padding: 0rpx 20rpx;
background-color: #eee;
}
|
三、js页面代码如下:
// bookList.js
Page({
/**
* 页面的初始数据
*/
data: {
bookList: [],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.requestData();
},
requestData: function () {
var that = this;
wx.request({
url: 'http://www.kindlepush.com/m/booklist/page/1/1',
success: function (res) {
console.log(res.data)
that.setData({
bookList: res.data
})
},
fail: function (err) {
console.log(err);
}
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
|