问题描述:
函数 onforclick(e) 中的参数 e 报错:参数“e”隐式具有“any”类型
wxml 代码如下:
<view wx:for="{{arr}}" wx:key="index" bindtap="onforclick" data-item="{{item}}" data-index="{{index}}"
class="box {{activeindex === index? 'active' : ''}}">
{{item.name}} ----{{item.price}} ---{{index}}
</view>
ts文件中的代码
onforclick(e){
let {item,index} =e.currentTarget.dataset
console.log(item)
console.log(index)
}
出错截图如下:
修改后的:
解决办法
onforclick(e:any) 参数 e 后面添加 :any
求问这样解决有啥问题么,还有其他解决办法没有(有些地方,不能这样添加 any ),此外这块报错是软件版本的问题吗(看了其他的教程没有这样的问题)?