小程序
小游戏
企业微信
微信支付
扫描小程序码分享
手机第一次联动不触发bindcolumnchange 事件,下边打印的东西都不出来,之后的地址联动js直接不能使用,但是bindchange事件
触发一次后,就可以正常联动,工具测试没有问题,手机为什么不可以???
1 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
/**
* 地址下级
*/
bindaddressColumnChange: function (e) {
var that = this;
console.log('修改的列为', e.detail.column, ',值为', e.detail.value);
console.log('第一次的值为'+that.data.statusaddress)
var data = {
addressArray: this.data.addressArray,
addressIndex: this.data.addressIndex,
statusaddress:1,
realEstateID: 0,
realEstateName: '请选择'
};
data.addressIndex[e.detail.column] = e.detail.value
if (e.detail.column == 0) {
var grade = this.data.addressArray[0][data.addressIndex[0]];
var CityData = that.data.tBDCity.filter((element) => (element.provinceID == that.data.tBDCity[e.detail.value].id));
var CityName = [], CityNum=[];
for (var i = 0; i < CityData.length; i++) {
CityName.push(CityData[i].name);
CityNum.push(CityData[i].id);
}
data.addressArray[1] = CityName
data.addressIndex[1] = 0;
this.setData({
CityData: CityData
})
var ZoneData = that.data.tBDZone.filter((element) => (element.cityID == CityData[0].id));
console.log(ZoneData)
var ZoneName = [];
for (var i = 0; i < ZoneData.length; i++) {
ZoneName.push(ZoneData[i].name);
data.addressArray[2] = ZoneName
data.addressIndex[2] = 0
} else if (e.detail.column == 1) {
console.log(this.data.CityData)
var classes = this.data.addressArray[1][data.addressIndex[1]];
console.log(classes)
// 二级id
var cityid = that.data.CityData.filter((element) => (element.name == classes));
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
微信 7.0.9
系统 9.1.0.336
/**
* 地址下级
*/
bindaddressColumnChange: function (e) {
var that = this;
console.log('修改的列为', e.detail.column, ',值为', e.detail.value);
console.log('第一次的值为'+that.data.statusaddress)
var data = {
addressArray: this.data.addressArray,
addressIndex: this.data.addressIndex,
statusaddress:1,
realEstateID: 0,
realEstateName: '请选择'
};
data.addressIndex[e.detail.column] = e.detail.value
if (e.detail.column == 0) {
var grade = this.data.addressArray[0][data.addressIndex[0]];
var CityData = that.data.tBDCity.filter((element) => (element.provinceID == that.data.tBDCity[e.detail.value].id));
var CityName = [], CityNum=[];
for (var i = 0; i < CityData.length; i++) {
CityName.push(CityData[i].name);
CityNum.push(CityData[i].id);
}
data.addressArray[1] = CityName
data.addressIndex[1] = 0;
this.setData({
CityData: CityData
})
var ZoneData = that.data.tBDZone.filter((element) => (element.cityID == CityData[0].id));
console.log(ZoneData)
var ZoneName = [];
for (var i = 0; i < ZoneData.length; i++) {
ZoneName.push(ZoneData[i].name);
}
data.addressArray[2] = ZoneName
data.addressIndex[2] = 0
} else if (e.detail.column == 1) {
console.log(this.data.CityData)
var classes = this.data.addressArray[1][data.addressIndex[1]];
console.log(classes)
// 二级id
var cityid = that.data.CityData.filter((element) => (element.name == classes));
你好,那个问题又出现了,第一次滚动的时候这里的代码都打印不出来,只有点击确定按钮以后,再次滚动才能打印。