赞
踩
微信小程序bindtap点击事件如何传参
<view class="fix-add" bind:tap="goPage('/family_pages/form_electricity/form_electricity')">
<van-icon name="add" />
</view>
goPage(url){
console.log(url)
}
点击后会有以下提示:
bindtap在传参时需要用到data-xxx来进行传递参数,如下:
<view class="fix-add" bind:tap="goPage" data-url="/family_pages/form_electricity/form_electricity">
<van-icon name="add" />
</view>
goPage(event){
console.log(event.currentTarget.dataset.url)
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。