WAService.js:3 thirdScriptError
data is not defined;at “pages/index/index” page onShareAppMessage function
ReferenceError: data is not defined
at e.onShareAppMessage (http://1431681330.appservice.open.weixin.qq.com/pages/index/index.js:170:21)
at e.<anonymous> (http://1431681330.appservice.open.weixin.qq.com/WAService.js:9:336)
at e.a (http://1431681330.appservice.open.weixin.qq.com/WAService.js:8:27066)
at L (http://1431681330.appservice.open.weixin.qq.com/WAService.js:8:23237)
at N (http://1431681330.appservice.open.weixin.qq.com/WAService.js:8:24123)
at http://1431681330.appservice.open.weixin.qq.com/WAService.js:8:28571
at Object.tapShareButton (http://1431681330.appservice.open.weixin.qq.com/WAService.js:8:25285)
at n.<anonymous> (http://1431681330.appservice.open.weixin.qq.com/asdebug.js:1:13708)
at n.emit (http://1431681330.appservice.open.weixin.qq.com/asdebug.js:1:8747)
at r (http://1431681330.appservice.open.weixin.qq.com/asdebug.js:1:1385)
这种情况怎么解决呀??
除了这个还要定义什么吗?
我要做的是一个页面的分享,页面上有一些数据信息,去掉data哪一行的话 分享出去会提示页面不存在,加上他分享出去后页面可以打开,但是没有携带数据信息。。
//index.js
//获取应用实例
var app = getApp()
Page({
data: {
addtel:’’,
// phoneNum: ‘154549865’//测试用的号码,并非真实号码
addtel1: ‘’,
addtel2: ‘’,
addtel3: ‘’,
addtel4: ‘’,
addtel5: ‘’,
addtel6: ‘’,
addtel7: ‘’,
addtel8:’’,
},
onShow: function () {
var that = this;
wx.getStorage({
key: ‘addTel’,
success: function (res) {
console.log(res.data)
that.setData({
addtel: res.data
})
}
}),
wx.getStorage({
key: ‘addTel1’,
success: function (res) {
console.log(res.data)
that.setData({
addtel1: res.data
})
}
}),
wx.getStorage({
key: ‘addTel2’,
success: function (res) {
console.log(res.data)
that.setData({
addtel2: res.data
})
}
}),
wx.getStorage({
key: ‘addTel3’,
success: function (res) {
console.log(res.data)
that.setData({
addtel3: res.data
})
}
}),
wx.getStorage({
key: ‘addTel4’,
success: function (res) {
console.log(res.data)
that.setData({
addtel4: res.data
})
}
}),
wx.getStorage({
key: ‘addTel5’,
success: function (res) {
console.log(res.data)
that.setData({
addtel5: res.data
})
}
}),
wx.getStorage({
key: ‘addTel6’,
success: function (res) {
console.log(res.data)
that.setData({
addtel6: res.data
})
}
}),
wx.getStorage({
key: ‘addTel7’,
success: function (res) {
console.log(res.data)
that.setData({
addtel7: res.data
})
}
}),
wx.getStorage({
key: ‘addTel8’,
success: function (res) {
console.log(res.data)
that.setData({
addtel8: res.data
})
}
})
},
onReady:function(){
},
//以下是拨打电话及地址地图的代码-----------------------------------------------------------------------
// 长按号码响应函数
phoneNumTap: function () {
var that = this;
// 提示呼叫号码还是将号码添加到手机通讯录
wx.showActionSheet({
itemList: [‘呼叫’, ‘添加联系人’],
success: function (res) {
if (res.tapIndex === 0) {
// 呼叫号码
wx.makePhoneCall({
phoneNumber: that.data.addtel,
})
} else if (res.tapIndex == 1) {
// 添加到手机通讯录
wx.addPhoneContact({
firstName: ‘test’,//联系人姓名
mobilePhoneNumber: that.data.addtel,//联系人手机号
})
}
}
})
},
phoneNumTapTwo: function () {
var that = this;
// 提示呼叫号码还是将号码添加到手机通讯录
wx.showActionSheet({
itemList: [‘呼叫’, ‘添加联系人’],
success: function (res) {
if (res.tapIndex === 0) {
// 呼叫号码
wx.makePhoneCall({
phoneNumber: that.data.addtel5,
})
} else if (res.tapIndex == 1) {
// 添加到手机通讯录
wx.addPhoneContact({
firstName: ‘test’,//联系人姓名
mobilePhoneNumber: that.data.addtel5,//联系人手机号
})
}
}
})
},
getLocation: function () {
wx.getLocation({
type: ‘gcj02’, //返回可以用于wx.openLocation的经纬度
success: function (res) {
var latitude = res.latitude
var longitude = res.longitude
var speed = res.speed;
var accuracy = res.accuracy;
console.log(latitude);
console.log(longitude);
console.log(speed);
console.log(accuracy);
wx.openLocation({
latitude: latitude,
longitude: longitude,
name: ‘鑫联必升文化发展有限公司’,
address: ‘北京市海淀区天秀路10号 农大国际创业园1-418’,
scale: 28
})
}
})
},
//以上是拨打电话及地址地图的代码--------------------------------------------------------------------
//以下是分享本页面代码--------------------
onShareAppMessage: function () {
return {
title: ‘个人名片信息’,
desc: ‘自定义分享描述’,
//path: ‘/page/user?id=123’,
path: ‘/page/index/index’,
data: { data }
}
}
//以上是分享本页面代码--------------------
})
这是我的代码,小白一个,望大神指点一二 谢谢!