在用uni-app,在页面中循环组件并传递下标。

在组件中的js代码‘transmitIndex’是我的点击事件。index传过来就是父页面循环产生的下标

data() {
        return {
            transmitIndexInfo: -1,
        };
    },
props: ['item','index'],
methods:{
  transmitIndex() {
  this.transmitIndexInfo = this.index;
console.log(this.transmitIndexInfo == this.idnex);
  }
}

不管在前后打印,数据类型判断看上去都没问题啊。
这是咋回事

img

你写错了,是

console.log(this.transmitIndexInfo == this.index)

你把你打印这块的完整代码截图看看!
原理上,单纯看这里,应该是true

this.transmitIndexInfo = this.index;
console.log(this.transmitIndexInfo == this.idnex);

你log的this.index拼错了