微信小程序(1)
来源:互联网 发布:刘嘉玲面膜淘宝店 编辑:程序博客网 时间:2024/04/28 12:42
flex.wxml:
<loading hidden="{{hidden}}" bindchange="loadingChange">
加载中...
</loading>
<scroll-view scroll-y="true" style="height: 100%;" bindscrolltolower="loadMore" bindscrolltoupper="refesh">
<view wx:if="{{hasRefesh}}" style="display: flex;flex-direction: row;align-items: center;align-self: center;justify-content: center;">
<icon type="waiting" size="45" />
<text>刷新中...</text>
</view>
<view wx:else style="display:none">
<text>没有更多内容了</text>
</view>
<view wx:for="{{goodsInfoList}}">
<view class="flex-row" style="display: flex;flex-direction: row">
<view>
<image src="http://img.114mall.com/{{item.imageImg1}}_300x300" class="flex-view-item" mode="scaleToFill"></image>
</view>
<view class="flex-column" style="display:flex;flex-direction: column;">
<text class="title">{{item.name}}</text>
<view class="view">
<text class="price">¥{{item.price/100}}</text>
<text class="price2">/</text>
<text class="price1">{{item.marketPrice/100}}</text>
</view>
<view class="view">
<text class="text1">已有{{item.sellCount}}人购买</text>
<text class="text1" style="margin-left: 30rpx;">所在地{{item.code}}</text>
</view>
</view>
</view>
</view>
<view class="tips1">
<view wx:if="{{hasMore}}" style="display: flex;flex-direction: row;align-items: center;align-self: center;justify-content: center;">
<icon type="waiting" size="45" />
<text>玩命的加载中...</text>
</view>
<view wx:else>
<text>没有更多内容了</text>
</view>
</view>
</scroll-view>
flex.js:
var app = getApp();
Page({
data: {
goodsInfoList: [],
hidden: false,
page: 1,
size: 20,
hasMore: true,
hasRefesh: false
},
onLoad: function () {
console.log("onLoad");
var that = this;
let map = new Map();
map.set("method", 'search.list');
map.set("shopId", "");
map.set("currentPage", "1");
map.set("categoryId", "");
map.set("order", "");
map.set("keywords", "");
network_util._post3(map, "1.0",
function (res) {
console.log(res);
that.setData({
goodsInfoList: res.data.result.goodsInfoList,
hidden: true
})
}, function (res) {
console.log(res);
});
},
onReachBottom: function (e) {
console.log("onReachBottom");
var that = this;
let map = new Map();
that.setData({
page: ++that.data.page
});
map.set("method", 'search.list');
map.set("shopId", "");
map.set("currentPage", that.data.page);
map.set("categoryId", "");
map.set("order", "");
map.set("keywords", "");
that.setData({
hasRefesh: true,
hidden: true
});
if (!this.data.hasMore) return
network_util._post3(map, "1.0",
function (res) {
console.log(res);
that.setData({
goodsInfoList: that.data.goodsInfoList.concat(res.data.result.goodsInfoList),
hidden: true,
hasRefesh: true,
})
}, function (res) {
console.log(res);
});
},
onPullDownRefresh: function (e) {
console.log("refesh");
that.setData({
hasRefesh: true,
});
var that = this;
let map = new Map();
that.setData({
page: 1
});
map.set("method", 'search.list');
map.set("shopId", "");
map.set("currentPage", that.data.page);
map.set("categoryId", "");
map.set("order", "");
map.set("keywords", "");
network_util._post3(map, "1.0",
function (res) {
that.setData({
goodsInfoList: res.data.result.goodsInfoList,
hidden: true,
hasRefesh: false,
});
}, function (res) {
console.log(res);
})
},
onReady: function () {
// 页面渲染完成
},
onShow: function () {
// 页面显示
},
onHide: function () {
// 页面隐藏
},
onUnload: function () {
// 页面关闭
},
loadingChange: function () {
console.log("loadingChange");
},
onShareAppMessage: function () {
return {
title: '自定义分享标题',
path: '/page/user?id=123'
}
},
refesh: function () {
console.log("saassasasasasa");
}
})
var network_util = require('../../utils/network_util.js');
var Util = require('../../utils/util.js');
https://github.com/lcs353732057/WeixinLittleProgramBy114MALL
- 微信小程序(1)
- 微信小程序(1)
- 微信小程序学习(1)_微信小程序简介
- 微信小程序教程(1)
- 微信小程序(1 初识)
- 微信小程序(1)—小程序注册
- 微信小程序< 1 > ~ Hello 微信小程序
- 微信小程序开发教程(1:初识)
- 微信小程序学习笔记(1)--------准备工作
- 微信小程序的学习(1)
- 微信小程序上手篇(1)
- 微信小程序上手篇(1)
- 微信小程序 入门详细介绍 (1)
- 微信小程序上手篇(1)
- 微信小程序上手篇(1)
- 微信小程序系列1(准备工作)
- 微信小程序开发教程(1)
- 微信小程序学习笔记(1)
- SSL协议会话建立过程解析
- jquery事件bind方法
- 关于JS中的JSON
- 接口优化小思
- Stats
- 微信小程序(1)
- Android APP测试流程
- String to Integer (atoi)-LeetCode
- iOS
- spring cloud 准备工作1
- NSUserDefaults读取和写入自定义对象
- 为什么javascript会有两个表示“没有”的类型呢?
- echart饼图和折线图实例
- Unity资源热更之AssetBundle(1)———基本介绍