HTML代碼:<ul class="list"> <li class="item"
v-for='item of letters'
:key='item'
:ref='item' @click='handleClick' @touchstart='handleTouchStart' @touchmove='handleTouchMove' @touchend='handleTouchEnd'
>{{item}}</li>
</ul>邏輯代碼:handleTouchMove(){ console.log('handleTouchMove'); if (this.touchStatus) {
const startY = this.$refs.A[0].offsetTop console.log(this.$refs.A); =====>這個打印出數(shù)組來了,為什么? console.log(startY);
}
},數(shù)據(jù)項:letters =[A,B,C,D,E,F,G,H,I,.....,X,Y,Z]請問各位大佬,這里的ref是通過數(shù)據(jù)綁定的形式使用的時候,為啥 this.$refs.A打印出來的是一個數(shù)組?
添加回答
舉報
0/150
提交
取消