小程序 调用百度翻译api,res.data.dst为什么显示undefined?
var q=this.data.voteTitle.toLowerCase()
var from='en'
var to='zh'
var appid=''
var key=''
var salt = ''
var string = appid + q + salt + key
var sign = MD5.MD5(string)
console.log(sign)
var that=this
wx.request({
url: 'https://fanyi-api.baidu.com/api/trans/vip/translate',
data:{
q,
from,
to,
appid,
salt,
sign
},
method:'GET',
success:function (res){
console.log(res.data.trans_result)
console.log(res.data.src)
console.log(res.data.dict)
console.log(res.data.dst)
that.setData({
word: res.data.src,
pron:res.data.dict,
definition: res.data.dst,
})
}
为什么src,dst这些为undefined啊,第一次搞,不清楚啊