vue获取当前v-for里当前点击元素

app.vue

<template>
  <div id="app">
    <ul >
      <li v-for="(item,index) in con" :key="index" @click="say($event)">{{item}}</li>
    </ul>
  </div>
</template>

<script>
export default {
  name: "App",
  data() {
    return {
      con: ["a", "b"]
    };
  },
  methods: {
    say: function(event) {
		   //获取点击对象      
		   var el = event.currentTarget;
		   alert("当前对象的内容:"+el.innerHTML);
		}
  }
};
</script>

posted @ 2018-05-06 15:38  清风白水  阅读(13687)  评论(1编辑  收藏  举报