-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #385 from hongxiangliu/master
- Loading branch information
Showing
4 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
// pages/demo/scrollView.js | ||
Page({ | ||
|
||
/** | ||
* 页面的初始数据 | ||
*/ | ||
data: { | ||
session: [] | ||
}, | ||
|
||
/** | ||
* 生命周期函数--监听页面加载 | ||
*/ | ||
onLoad: function (options) { | ||
var that = this | ||
// 设置窗口大小 | ||
wx.getSystemInfo({ | ||
success: (res) => { | ||
that.setData({ | ||
windowHeight: res.windowHeight - 5, | ||
windowWidth: res.windowWidth | ||
}) | ||
//console.dir(that.data.windowHeight) | ||
} | ||
}) | ||
that.setData({ | ||
sessions: [{ | ||
name: "书签", | ||
icon: "a.png", | ||
msg : " 共12条" | ||
}, { | ||
name: "书讯", | ||
icon: "a.png", | ||
msg: "共8条" | ||
}, { | ||
name: "读书计划", | ||
icon: "a.png", | ||
msg: "数量。" | ||
}, { | ||
name: "家有藏书", | ||
icon: "b.png", | ||
msg: "数量" | ||
}, { | ||
name: "关注书本", | ||
icon: "a.png", | ||
msg: "数量。" | ||
}, { | ||
name: "添加书本", | ||
icon: "b.png", | ||
msg: "数量" | ||
}, { | ||
name: "Tom", | ||
icon: "a.png", | ||
msg: "您好。" | ||
}, { | ||
name: "John", | ||
icon: "b.png", | ||
msg: "在吗?" | ||
}] | ||
}) | ||
}, | ||
|
||
/** | ||
* 生命周期函数--监听页面初次渲染完成 | ||
*/ | ||
onReady: function () { | ||
|
||
}, | ||
|
||
/** | ||
* 生命周期函数--监听页面显示 | ||
*/ | ||
onShow: function () { | ||
|
||
}, | ||
|
||
/** | ||
* 生命周期函数--监听页面隐藏 | ||
*/ | ||
onHide: function () { | ||
|
||
}, | ||
|
||
/** | ||
* 生命周期函数--监听页面卸载 | ||
*/ | ||
onUnload: function () { | ||
|
||
}, | ||
|
||
/** | ||
* 页面相关事件处理函数--监听用户下拉动作 | ||
*/ | ||
onPullDownRefresh: function () { | ||
|
||
}, | ||
|
||
/** | ||
* 页面上拉触底事件的处理函数 | ||
*/ | ||
onReachBottom: function () { | ||
|
||
}, | ||
|
||
/** | ||
* 用户点击右上角分享 | ||
*/ | ||
onShareAppMessage: function () { | ||
|
||
}, | ||
|
||
onEnd : function(e) { | ||
console.dir(e) | ||
var that = this; | ||
that.setData({ | ||
//isLower: true, | ||
sessions: that.data.sessions.concat([{ | ||
name: "书签", | ||
icon: "a.png", | ||
msg: "共12条" | ||
}, { | ||
name: "添加书本", | ||
icon: "b.png", | ||
msg: "数量" | ||
}]) | ||
}) | ||
|
||
}, | ||
|
||
onScroll: function() { | ||
console.dir("onScroll"); | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!--pages/demo/scrollView.wxml--> | ||
<scroll-view class="page" scroll-y="true" style="height:{{windowHeight}}px;" bindscrolltolower="onEnd" bindscroll="onScroll"> | ||
<view class="page__hd"> | ||
<view class="page__title"></view> | ||
<view class="page__desc"></view> | ||
</view> | ||
<view class="page__bd"> | ||
<view class="weui-panel weui-panel_access"> | ||
<view class="weui-panel__hd"></view> | ||
<view class="weui-panel__bd"> | ||
<navigator url="" wx:for="{{sessions}}" wx:key="name" class="weui-media-box weui-media-box_appmsg" hover-class="weui-cell_active"> | ||
<view class="weui-media-box__hd weui-media-box__hd_in-appmsg"> | ||
<image class="weui-media-box__thumb" src="../example/images/a.png" /> | ||
</view> | ||
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg"> | ||
<view class="weui-media-box__title">({{index+1}}) {{item.name}}</view> | ||
<view class="weui-media-box__desc">{{item.msg}}</view> | ||
</view> | ||
</navigator> | ||
</view> | ||
</view> | ||
<view class="weui-loadmore" wx:if="{{isLower}}"> | ||
<view class="weui-loading"></view> | ||
<view class="weui-loadmore__tips">正在加载</view> | ||
</view> | ||
<view class="weui-loadmore weui-loadmore_line" wx:if="{{isEnd}}"> | ||
<view class="weui-loadmore__tips weui-loadmore__tips_in-line">暂无数据</view> | ||
</view> | ||
</view> | ||
</scroll-view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* pages/demo/scrollView.wxss */ |