使用e.target.dataset出现的问题

var path = e.currentTarget.dataset.imagePath

console.log(path);会输出undefined

1)去掉data后面驼峰命名

imagePath -> imagepath

2)直接输出e来查看

console.log(e)

摘自https://www.cnblogs.com/xiaoli52qd/p/7857468.html

猜你喜欢

转载自blog.csdn.net/Rgemmm/article/details/89296742