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:"<a href='http://fjdx.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">福建电信下载</a>
↵<a href='http://xmdx.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">厦门电信下载</a>
↵<a href='http://gddx.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">广东电信下载</a>
↵<a href='http://jsdx.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">江苏电信下载</a>
↵<a href='http://fjlt.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">福建联通下载</a>
↵<a href='http://zjlt.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">浙江联通下载</a>
↵<a href='http://xmlt.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">厦门联通下载</a>
↵<a href='http://gdlt.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">广东联通下载</a>
↵<a href='http://fjyd.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">福建移动下载</a>
↵<a href='http://sxyd.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">山西移动下载</a>
↵<a href='http://xmyd.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">厦门移动下载</a>
↵<a href='http://zjyd.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">浙江移动下载</a>"
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:"<a href='http://fjdx.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">福建电信下载</a>
↵<a href='http://xmdx.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">厦门电信下载</a>
↵<a href='http://gddx.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">广东电信下载</a>
↵<a href='http://jsdx.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">江苏电信下载</a>
↵<a href='http://fjlt.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">福建联通下载</a>
↵<a href='http://zjlt.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">浙江联通下载</a>
↵<a href='http://xmlt.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">厦门联通下载</a>
↵<a href='http://gdlt.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">广东联通下载</a>
↵<a href='http://fjyd.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">福建移动下载</a>
↵<a href='http://sxyd.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">山西移动下载</a>
↵<a href='http://xmyd.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">厦门移动下载</a>
↵<a href='http://zjyd.sc.chinaz.com/Files/DownLoad/psd1/201808/psd27155.rar' target="_blank">浙江移动下载</a>"
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
})
是数组,试了下你说的方法,控制台报错
unknown: Unexpected token, expected ,
这个报错应该和你这个代码片段无关了,查下其它地方代码
还是粗心大意了。修改的时候不小心在上面一行代码多加了字母。谢谢大神。