一个循环体内,click事件,获取不到循环体的值
<view class="hot-building-item" v-for="(item, value) in conts" :key="item.value">
<view class="hot-building-item_image">
<image :src="item.src" @click="propertyInfo(item.value)"></image>
</view>
</view>
事件是执行了,但是得到的参数为undefined
propertyInfo(id)
{
console.log(id)
//uni.navigateTo({url: '/pages/buildDetail/buildDetail?id='+id});
},
只需要加一个()=>即可
<image :src="item.src" @click="()=>propertyInfo(item.value)"></image>