public function indexajax()
{
header("Content-type:text/html;charset=utf-8");
$alist = Articles::with('articleimg')->select()->toJson();
return $alist;
}
onLoad: function () {
this.getArticles() //
},
//自定义函数
getArticles:function(){
var that = this;
wx.request({
url: 'http://url', //远程json
success: function (res) {
console.log(res.data)
that.setData({
articles: res.data
})
}
})
}
//page的data中必须声明用中括号也可以的
articles:{},
网友评论