怎么显示 Id:1 的数据 代码怎么实现
请大佬帮忙看看
在test里面接收的id再去请求接口获取name就行了吧
比如这样:
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
var that = this
//文章信息
wx.request({
url:'/index.php?m=mobile&c=index&a=x_articleShow',
data: {
id: options.id,
},
header: {
'Content-Type': 'application/json'
},
dataType: 'json',
method: 'GET',
success: function(res) {
if (res == false) {
wx.redirectTo({
url: '/pages/index/index',
})
}
WxParse.wxParse('content', 'html', res.data.content, that, 5);
that.setData({
article: res.data,
});
},
fail: function() {
console.log('error!!!!!!!!!!!!!!');
wx.redirectTo({
url: '/pages/index/index',
})
}
})
},
根据你自己的实际需要处理返回的结果就行了