v-for循环给某个item添加点击事件

Posted 青袂婉梦

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了v-for循环给某个item添加点击事件相关的知识,希望对你有一定的参考价值。


<template>
    <view class="bread" v-for="(item, index) in nodePathArray" :key="index" @click='HandleClick(item)'>
        item.name
    </view>
</template>

   methods:
      HandleClick(index)
          //点击事件
          if (item.index === 0) 
            this.$router.go(0)
          
      

以上是关于v-for循环给某个item添加点击事件的主要内容,如果未能解决你的问题,请参考以下文章

v-for循环某个item添加样式

给Listview里面Item里的每一个控件怎么设定点击事件

vue文本中给某个字添加点击事件

Vue3实现列表循环

vue如何动态给三种颜色

C#listview 添加的item怎么添加点击事件