From 29a39997a702a087ab0da5b8f1be1146b47cec7c Mon Sep 17 00:00:00 2001 From: 351655914 <351655914@qq.com> Date: Sun, 12 Nov 2017 22:45:09 +0800 Subject: [PATCH] =?UTF-8?q?#3=20#38=20=E7=AC=AC3=E6=AC=A1=E5=AE=9E?= =?UTF-8?q?=E9=AA=8C=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1514080901116/pages/index/index.js | 126 +++++++++++++++++++++++++-- 1514080901116/pages/index/index.wxml | 47 +++++----- 1514080901116/pages/index/index.wxss | 10 +-- 3 files changed, 144 insertions(+), 39 deletions(-) diff --git a/1514080901116/pages/index/index.js b/1514080901116/pages/index/index.js index c74dd36a..8c06612a 100644 --- a/1514080901116/pages/index/index.js +++ b/1514080901116/pages/index/index.js @@ -1,12 +1,122 @@ +// pages/demo/scrollView.js var base64 = require("../images/base64"); Page({ - onLoad: function(){ - this.setData({ - icon20: base64.icon20, - icon60: base64.icon60 + + /** + * 页面的初始数据 + */ + data: { + session: [] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var that = this + // 设置窗口大小 + wx.getSystemInfo({ + success: (res) => { + that.setData({ + windowHeight: res.windowHeight - 5, + windowWidth: res.windowWidth }) - }, - inputChange: function (e) { - this.data.inputValue = e.detail.value; - } + //console.dir(that.data.windowHeight) + } + }) + this.setData({ + icon20: base64.icon20, + icon60: base64.icon60 + }) + that.setData({ + sessions: [{ + name: "", + msg: "你孤单的时候想干嘛?喝汽水,因为当你孤单你会想起谁(汽水)。" + }, { + name: "", + msg: "我曾经得过精神分裂症,但现在我们已经康复了。" + }, { + name: "", + msg: "你孤单的时候想干嘛?喝汽水,因为当你孤单你会想起谁(汽水)。" + }, { + name: "", + msg: "我曾经得过精神分裂症,但现在我们已经康复了。" + }, { + name: "", + msg: "你孤单的时候想干嘛?喝汽水,因为当你孤单你会想起谁(汽水)。" + }, { + name: "", + 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: "", + msg: "你孤单的时候想干嘛?喝汽水,因为当你孤单你会想起谁(汽水)。" + }, { + name: "", + msg: "我曾经得过精神分裂症,但现在我们已经康复了。" + }]) + }) + + }, + + onScroll: function () { + console.dir("onScroll"); + } }) \ No newline at end of file diff --git a/1514080901116/pages/index/index.wxml b/1514080901116/pages/index/index.wxml index 412d8036..a107fb9e 100644 --- a/1514080901116/pages/index/index.wxml +++ b/1514080901116/pages/index/index.wxml @@ -1,17 +1,19 @@ - + + - + + - + - + 幽默故事会 @@ -27,33 +29,26 @@ - - - - 查看更多 - - - - - - - - 段子一 - 你孤单的时候想干嘛?喝汽水,因为当你孤单你会想起谁(汽水)。 - - - 段子二 - 我曾经得过精神分裂症,但现在我们已经康复了。 - - 查看更多 + + + 段子{{index+1}} {{item.name}} + {{item.msg}} + + - + + + + 正在加载 + + + 暂无数据 + - - \ No newline at end of file + diff --git a/1514080901116/pages/index/index.wxss b/1514080901116/pages/index/index.wxss index 173cbfc7..8d386caa 100644 --- a/1514080901116/pages/index/index.wxss +++ b/1514080901116/pages/index/index.wxss @@ -2,7 +2,7 @@ display: flex; flex-direction: column; align-items: center; - height: 100%; + height: auto; } .search-bar { @@ -13,7 +13,7 @@ height: 70rpx; line-height: 70rpx; width: 140rpx; - position: fixed; + position: absolute; top: 20rpx; left: 585rpx; font-size: 30rpx; @@ -28,16 +28,16 @@ margin-top: 20rpx; /*text-indent: 70rpx;*/ margin-bottom: 15rpx; - position: fixed; + position: absolute; top: 0; left: 25rpx; padding-left: 70rpx; } - .weui-icon-search_in-box{ position: absolute; top: 40rpx; left: 40rpx; z-index: 1; -} \ No newline at end of file +} +