Vue报错:[Vue warn]: Error in v-on handler: “TypeError: e.target.getBoundingClientRect is not a function”
实例
addToCart:function(e){
this.show = true;
this.eltop = e.target.getBoundingClientRect().top;
this.elleft = e.target.getBoundingClientRect().left;
console.log(this.eltop)
console.log(this.elleft)
},
报错
最终修改方案
将e修改为event
addToCart:function(){
this.show = true;
this.eltop = event.target.getBoundingClientRect().top;
this.elleft = event.target.getBoundingClientRect().left;
console.log(this.eltop)
console.log(this.elleft)
},