<view class="cart-img" @click="gotoCart($event)">
<image class="cart-image" :src="'https://img-cdn-qiniu.dcloud.net.cn/uniapp/uni-ui/goodsnav/carts.png'"></image>
</view>
gotoCart(event){
console.log(event)
}
在vue中可以通过$event对象获取原生事件。
- 带圆括号的形式,需要使用$event显式传入event变量;
- 不带圆括号的形式,event被自动作为实参传入