Skip to content

Commit

Permalink
Merge pull request #456 from AllenMinD/master
Browse files Browse the repository at this point in the history
#5 #9 第5次实验代码 请求数据
  • Loading branch information
zengsn authored Dec 1, 2017
2 parents c2deaa5 + b5e3d35 commit 6101b0e
Showing 1 changed file with 40 additions and 39 deletions.
79 changes: 40 additions & 39 deletions 1514080901122/pages/student-list/student-list.js
Original file line number Diff line number Diff line change
@@ -1,48 +1,49 @@
var tempNum = 0;
Page({
data: {
students: [
{
sNum: "1122",
name:'比尔盖茨'
},
{
sNum: "1124",
name:'扎克伯格'
},
{
sNum: "1136",
name:'老王'
},
{
sNum: "1148",
name: '老李'
},
{
sNum: "1155",
name:'杨赵'
},
{
sNum: "5155",
name: '呵呵大'
students: []
},

onLoad: function(options) {
var that = this;
wx.request({
url: "http://www.easy-mock.com/mock/5a1f5ba9ca645757c0517e26/wechat-app-test/student-list",
success: function (res) {
var resData = res.data.data;
that.setData({
students: resData
});
}
]
});
},

more: function (e) {
console.log(e);
tempNum++;
var newGuy = {
sNum: "11" + tempNum,
name: "神秘人"
};
if (tempNum <= 35) {
this.data.students.push(newGuy);
this.setData({
students: this.data.students,
})
} else {
console.log("全员到齐!");
}
//console.log(e);
var that = this;
wx.request({
url: 'http://easy-mock.com/mock/5a20c161be1c8248fef10e93/wechat-app-test2/web-wechat-test2',
success: function(res) {
var resData = res.data.data;
//console.log(resData);
that.setData({
students: that.data.students.concat(resData)
});
console.log(that.data.students)
}
})
// tempNum++;
// var newGuy = {
// sNum: "11" + tempNum,
// name: "神秘人"
// };
// if (tempNum <= 35) {
// //this.data.students.push(newGuy);
// this.setData({
// students: this.data.students,
// })
// } else {
// console.log("全员到齐!");
// }
}

})

0 comments on commit 6101b0e

Please sign in to comment.