detail.js
Page({
data: {},
onLoad: function(options) {
let postId = options.id
this.dbPost = new DBPost(postId)
this.postData = this.dbPost.getPostItemById().data
this.setData({
post: this.postData
})
this.addReadingTimes()
// this.setMusicMonitor()
// this.initMusicStatus()
},
onReady: function() {
wx.setNavigationBarTitle({
title: this.postData.title
})
},
freeTell: function(){
wx.makePhoneCall({
phoneNumber:this.postData.phNum,
success:function(){
console.log('拨打成功')
},
fail:function(){
console.log('拨打失败')
}
})},
data.js
let postList = [
{phNum:'18602059431'},]
报错makePhoneCall:fail parameter error: parameter.phoneNumber should be String instead of Undefined;
data.js 里通过 export default {}导出,在detail.js引入,然后电话必须是字符串,this.postData.phNum 这里不是,我猜是少了下标,你定义的数据是个数组的嘛