RT,求大神解答。
数据库取出的数据如下:
[{0: "彭德怀", 1: "2018.08.30", 2: "中秋佳节促销海报设计",…}]
0:{0: "彭德怀", 1: "2018.08.30", 2: "中秋佳节促销海报设计",…}0:"彭德怀"
1:"2018.08.30"
2:"中秋佳节促销海报设计"
3:"http://pic2.sc.chinaz.com/files/pic/psd1/201808/psd27155.jpg"
4:"福建电信下载 ?厦门电信下载 ?广东电信下载 ?江苏电信下载 ?福建联通下载 ?浙江联通下载 ?厦门联通下载 ?广东联通下载 ?福建移动下载 ?山西移动下载 ?厦门移动下载 ?浙江移动下载"
5:"36291"
6:"中秋佳节促销海报设计适用于中秋节海报设计"
7:"中秋节,中秋海报,月饼,中秋佳节,喜庆,节日素材,活动海报,促销海报,海报设计"
8:"庆典节日PSD素材"
9:"24"
10:"0"
11:"0"
12:"0"
13:"0"
14:"usertouxiang/pengdiehua.jpg"
biaoqian:"中秋节,中秋海报,月饼,中秋佳节,喜庆,节日素材,活动海报,促销海报,海报设计"
cais:"0"
psd_id:"36291"
psd_leibie:"庆典节日PSD素材"
psd_miaoshu:"中秋佳节促销海报设计适用于中秋节海报设计"
psd_name:"中秋佳节促销海报设计"
psd_spic:"http://pic2.sc.chinaz.com/files/pic/psd1/201808/psd27155.jpg"
psd_time:"2018.08.30"
psd_user:"彭德怀"
psd_xiazai:"福建电信下载 ?厦门电信下载 ?广东电信下载 ?江苏电信下载 ?福建联通下载 ?浙江联通下载 ?厦门联通下载 ?广东联通下载 ?福建移动下载 ?山西移动下载 ?厦门移动下载 ?浙江移动下载"
scs:"0"
shares:"0"
user_touxiang:"usertouxiang/pengdiehua.jpg"
views:"24"
zans:"0"
js部分代码如下:
Page({
data: {
id: '',
ids: '',
idss: ''
},
onLoad: function (options) {
this.setData({
id: options.id
});
// var idss=this.date.id;
var ids = this.data.id;
var that = this;
wx.request({
url: 'https://www.bbjteam.com/xiaochenxu/bbjteam/index.psdinfo.php',
method: 'POST',
data: {
ids: ids
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
success: function (res) {
that.setData({
psdinfo: res.data,
});
wx.setNavigationBarTitle({
title: that.data.psdinfo.psd_name
})
}
})
}
})
运行报错:
setNavigationBarTitle:fail parameter error: parameter.title should be String instead of Undefined;
请问大神这个应该如何解决?
微信小程序开发问题解答
微信小程序开发者回答:
你这个接口返回的是一个数组格式,而不是直接对象吧?试试
wx.setNavigationBarTitle({
title: that.data.psdinfo[0].psd_name
})
本文网址:http://www.91bianli.com/weixinxiaochengxu/51395.html