Skip to content

Commit

Permalink
Merge pull request #307 from Moxiuzhu/master
Browse files Browse the repository at this point in the history
#3 #11 使用组件scroll-view来设计滚动页面
  • Loading branch information
zengsn authored Nov 15, 2017
2 parents f388c53 + d5be97b commit e61c08c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 9 deletions.
23 changes: 23 additions & 0 deletions 1514080901221/pages/index/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ const app = getApp()
Page({
data: {
inputShowed: false,
scrollTop: 100,
windowHeight: 0,
inputVal:'',
moodList: [{ id: 0, content: '开心,今天真的是元气满满的一天。', img: '', time: '2016年10月2日 00:80' },
{ id: 1, content: '啊,好像要下雨了,我可以选择品读一本书静静地听雨了', img: '', time: '2012年10月2日 00:80' },
{ id: 2, content: '[email protected],这个是我的邮箱哦', img: '', time: '2010年10月2日 00:80' },
{ id: 2, content: '[email protected],这个是我的邮箱哦', img: '', time: '2010年10月2日 00:80' },
{ id: 2, content: '[email protected],这个是我的邮箱哦', img: '', time: '2010年10月2日 00:80' },
{ id: 2, content: '[email protected],这个是我的邮箱哦', img: '', time: '2010年10月2日 00:80' },
{ id: 2, content: '[email protected],这个是我的邮箱哦', img: '', time: '2010年10月2日 00:80' }]
},
showInput: function () {
Expand All @@ -28,9 +34,26 @@ Page({
this.setData({
inputVal: e.detail.value
});
},
upper: function (e) {
// console.log(e)
},
lower: function (e) {
// console.log(e)
},
scroll: function (e) {
// console.log(e)
},
onLoad: function (options) {
var _this = this;
wx.getSystemInfo({
success: function (res) {
console.log(res.windowHeight);
_this.setData({
windowHeight: res.windowHeight
});
}
})
app.getUserInfo(function (userInfo) {
console.log(userInfo);
_this.setData({
Expand Down
20 changes: 11 additions & 9 deletions 1514080901221/pages/index/index.wxml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<view class="page">
<view class="page__bd">
<view class="weui-search-bar">
<view class="weui-search-bar" style='display:fixed;'>
<view class="weui-search-bar__form">
<view class="weui-search-bar__box">
<icon class="weui-icon-search_in-box" type="search" size="14"></icon>
Expand All @@ -17,12 +17,14 @@
<view class="weui-search-bar__cancel-btn" hidden="{{!inputShowed}}" bindtap="hideInput">取消</view>
</view>
</view>
<view class='itemList' wx:for="{{moodList}}" wx:key="mood">
<navigator url='../../pages/detail/detail?id={{item.id}}'>
<view class='list'>
<view class='content'>{{item.content}}</view>
<view class='time'>{{item.time}}</view>
</view>
</navigator>
</view>
<scroll-view scroll-y style="height: {{windowHeight}}px;" bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" scroll-top="{{scrollTop}}">
<view class='itemList' wx:for="{{moodList}}" wx:key="mood">
<navigator url=''>
<view class='list'>
<view class='content'>{{item.content}}</view>
<view class='time'>{{item.time}}</view>
</view>
</navigator>
</view>
</scroll-view>
</view>

0 comments on commit e61c08c

Please sign in to comment.