emmmm这个网站真是会出难题 另一种解析json
json数据如下
{
"reason":"请求成功",
"result":{
"list":[
{
"id":"wechat_20180506012503",
"title":"30岁左右,手头有10几20万,这4台合资B级车是首选!",
"source":"有车以后",
"firstImg":"http:\/\/zxpic.gtimg.com\/infonew\/0\/wechat_pics_-62933322.static\/640",
"mark":"",
"url":"http:\/\/v.juhe.cn\/weixin\/redirect?wid=wechat_20180506012503"
},
{
"id":"wechat_20180506012489",
"title":"一曲流连 | 张宇:这场戏的结局,一言难尽",
"source":"淘漉音乐",
"firstImg":"http:\/\/zxpic.gtimg.com\/infonew\/0\/wechat_pics_-62933253.jpg\/640",
"mark":"",
"url":"http:\/\/v.juhe.cn\/weixin\/redirect?wid=wechat_20180506012489"
},
{
"id":"wechat_20180506012505",
"title":"惠若琪再受重用!大婚之后就敬业蜜月都不过,新工作太让人敬佩!",
"source":"懂小姐miss",
"firstImg":"http:\/\/zxpic.gtimg.com\/infonew\/0\/wechat_pics_-62933361.jpg\/640",
"mark":"",
"url":"http:\/\/v.juhe.cn\/weixin\/redirect?wid=wechat_20180506012505"
},
{
"id":"wechat_20180506012499",
"title":"王家卫的电影,如果拿掉音乐会是什么样子?",
"source":"淘漉音乐",
"firstImg":"http:\/\/zxpic.gtimg.com\/infonew\/0\/wechat_pics_-62933253.jpg\/640",
"mark":"",
"url":"http:\/\/v.juhe.cn\/weixin\/redirect?wid=wechat_20180506012499"
},
{
"id":"wechat_20180506012538",
"title":"别被坑了!车漆小划痕发黄其实你自己都能解决",
"source":"玩车教授",
"firstImg":"http:\/\/zxpic.gtimg.com\/infonew\/0\/wechat_pics_-62933537.jpg\/640",
"mark":"",
"url":"http:\/\/v.juhe.cn\/weixin\/redirect?wid=wechat_20180506012538"
},
{
"id":"wechat_20180506012458",
"title":"只有加工资才能救中国经济!(深度好文)",
"source":"郎club",
"firstImg":"",
"mark":"",
"url":"http:\/\/v.juhe.cn\/weixin\/redirect?wid=wechat_20180506012458"
},
{
"id":"wechat_20180506012481",
"title":"这些中国力量纷纷崛起,厉害了我的国!",
"source":"汽车之家",
"firstImg":"http:\/\/zxpic.gtimg.com\/infonew\/0\/wechat_pics_-62933205.static\/640",
"mark":"",
"url":"http:\/\/v.juhe.cn\/weixin\/redirect?wid=wechat_20180506012481"
},
{
"id":"wechat_20180506012480",
"title":"“25岁时,我的月薪是1000个馒头”",
"source":"MBA智库",
"firstImg":"http:\/\/zxpic.gtimg.com\/infonew\/0\/wechat_pics_-62933201.jpg\/640",
"mark":"",
"url":"http:\/\/v.juhe.cn\/weixin\/redirect?wid=wechat_20180506012480"
},
{
"id":"wechat_20180504035764",
"title":"海南楼市,一夜冰火:销售称遭灭顶之灾,地产商陷入群体性迷茫!",
"source":"金融行业网",
"firstImg":"http:\/\/zxpic.gtimg.com\/infonew\/0\/wechat_pics_-62932267.jpg\/640",
"mark":"",
"url":"http:\/\/v.juhe.cn\/weixin\/redirect?wid=wechat_20180504035764"
},
{
"id":"wechat_20180504035367",
"title":"夏天高温,车自燃都是这四个原因所致!",
"source":"车早茶",
"firstImg":"http:\/\/zxpic.gtimg.com\/infonew\/0\/wechat_pics_-62932204.jpg\/640",
"mark":"",
"url":"http:\/\/v.juhe.cn\/weixin\/redirect?wid=wechat_20180504035367"
},
{
"id":"wechat_20180502038663",
"title":"82岁老人电梯内伸“咸猪手”,家属:他患老年痴呆",
"source":"澎湃新闻",
"firstImg":"http:\/\/zxpic.gtimg.com\/infonew\/0\/wechat_pics_-62932044.static\/640",
"mark":"",
"url":"http:\/\/v.juhe.cn\/weixin\/redirect?wid=wechat_20180502038663"
},
{
"id":"wechat_20180502036740",
"title":"穿这条连衣裙的时候,别人都以为我90斤",
"source":"时尚COSMO",
"firstImg":"http:\/\/zxpic.gtimg.com\/infonew\/0\/wechat_pics_-62931701.jpg\/640",
"mark":"",
"url":"http:\/\/v.juhe.cn\/weixin\/redirect?wid=wechat_20180502036740"
},
{
"id":"wechat_20180502036748",
"title":"尴尬的70后;无奈的70后;辛苦的70后;奔五的70后",
"source":"音乐图文场景",
"firstImg":"http:\/\/zxpic.gtimg.com\/infonew\/0\/wechat_pics_-62931774.jpg\/640",
"mark":"",
"url":"http:\/\/v.juhe.cn\/weixin\/redirect?wid=wechat_20180502036748"
},
{
"id":"wechat_20180502036746",
"title":"轿车突然发疯冲向人群,他的一个动作却让所有人泪奔…",
"source":"广州日报",
"firstImg":"http:\/\/zxpic.gtimg.com\/infonew\/0\/wechat_pics_-62927222.static\/640",
"mark":"",
"url":"http:\/\/v.juhe.cn\/weixin\/redirect?wid=wechat_20180502036746"
},
{
"id":"wechat_20180502036753",
"title":"照谣镜2.0版(第十九期)",
"source":"中国搜索",
"firstImg":"http:\/\/zxpic.gtimg.com\/infonew\/0\/wechat_pics_-62931798.static\/640",
"mark":"",
"url":"http:\/\/v.juhe.cn\/weixin\/redirect?wid=wechat_20180502036753"
},
{
"id":"wechat_20180502037002",
"title":"我炒的青菜脆爽不发黄,因为多加这步,保证营养不流失!",
"source":"香哈菜谱",
"firstImg":"http:\/\/zxpic.gtimg.com\/infonew\/0\/wechat_pics_-62931901.jpg\/640",
"mark":"",
"url":"http:\/\/v.juhe.cn\/weixin\/redirect?wid=wechat_20180502037002"
},
{
"id":"wechat_20180502036973",
"title":"男子丢了一张身份证,这么多年他竟成了“坐过牢”的人",
"source":"南方都市报",
"firstImg":"http:\/\/zxpic.gtimg.com\/infonew\/0\/wechat_pics_-62909422.static\/640",
"mark":"",
"url":"http:\/\/v.juhe.cn\/weixin\/redirect?wid=wechat_20180502036973"
},
{
"id":"wechat_20180502036658",
"title":"为了玩小白脸,她把家里房子卖了!",
"source":"奔波儿灞与灞波儿奔",
"firstImg":"http:\/\/zxpic.gtimg.com\/infonew\/0\/wechat_pics_-62931563.jpg\/640",
"mark":"",
"url":"http:\/\/v.juhe.cn\/weixin\/redirect?wid=wechat_20180502036658"
},
{
"id":"wechat_20180502000690",
"title":"200斤、250斤、300斤......你认为猪体重多少出栏才最合算?",
"source":"养猪一家人",
"firstImg":"http:\/\/zxpic.gtimg.com\/infonew\/0\/wechat_pics_-62930825.jpg\/640",
"mark":"",
"url":"http:\/\/v.juhe.cn\/weixin\/redirect?wid=wechat_20180502000690"
},
{
"id":"wechat_20180501016442",
"title":"史诗丨巷战肉搏王者268V4 12.6K碾压伤害",
"source":"天下军武",
"firstImg":"http:\/\/zxpic.gtimg.com\/infonew\/0\/wechat_pics_-62930703.jpg\/640",
"mark":"",
"url":"http:\/\/v.juhe.cn\/weixin\/redirect?wid=wechat_20180501016442"
}
],
"totalPage":11583,
"ps":20,
"pno":1
},
"error_code":0
}
wxml
<!--pages/wcReading/wcReading.wxml-->
<text>微信精选</text>
<block wx:for="{{title}}" wx:key="this">
<view class='reading'>
<view class='title'>标题:{{title[index]}}</view>
<view class='source'>作者:{{source[index]}}</view>
<view class='firstImg'><image src="{{firstImg[index]}}"></image> </view>
<view class='url'>{{url[index]}}</view>
</view>
</block>
js
// pages/wcReading/wcReading.js
var app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function() {
var that = this;
wx.request({
url: 'http://v.juhe.cn/weixin/query?key=自己去申请',
header: {
'content-type': 'application/json'
},
success: function(res) {
console.log(res.data)
var list = res.data.result.list;
for (var i = 0; i <=19; i++) {
app.title.push(list[i].title);
app.source.push(list[i].source);
app.firstImg.push(list[i].firstImg);
app.url.push(list[i].url);
}
that.setData({
title: app.title,
source: app.source,
firstImg: app.firstImg,
url: app.url
})
console.log(res.data),
console.log(app),
console.log(app.title)
}
})
}
})
emmm这种现在还要改app.js才能在js中用var app = getApp()
emm,list:[]那个不用加