problem description
the debug window clearly shows that the result array has two elements, but it is always shown through the result.length page that the array length is zero
the environmental background of the problems and what methods you have tried
WeChat Mini Programs developed
related codes
/ / Please paste the code text below (do not replace the code with pictures)
html Code:
< view class= "weui-cells searchbar-result" wx:if= "{{inputVal.length > 0}}" >
<navigator url="" class="weui-cell" hover-class="weui-cell_active">
<view class="weui-cell__bd">
<view>{{result.length}}</view>
</view>
</navigator>
< / view >
js Code:
inputTyping: function (e) {
var num;
for (var i = 1; i < this.data.names.length; iPP) {
num = this.data.names[i].Key.indexOf(e.detail.value);
if (num != -1) {
this.data.result.push(this.data.names[i].Key)
}
}
console.log("re" + this.data.result.length)
console.log("input" + this.data.inputVal.length)
this.setData({
inputVal: e.detail.value
});
},