在vue.js中用v-for循环代码,怎么使li标签中的子元素获得该li标签的index值
代码:
<li class="posiRela counItem page-infinite-listitem clearfix" v-for="(item, index) in goods">
<img v-if="item.goodtype === '主机'" src="../../static/images/zhuji_icon.png">
<img v-if="item.goodtype === '笔记本'" src="../../static/images/computer_icon.png">
<img v-if="item.goodtype === '服务器'" src="../../static/images/fuwuqi_icon.png">
<img v-if="item.goodtype === '家具'" src="../../static/images/jiaju_icon.png">
<img v-if="item.goodtype === '电话机'" src="../../static/images/phone_icon.png">
<img v-if="item.goodtype === '打印机'" src="../../static/images/printer_icon.png">
<img v-if="item.goodtype === '手机'" src="../../static/images/tel_icon.png">
<img v-if="item.goodtype === '投影仪'" src="../../static/images/touying_icon.png">
<img v-if="item.goodtype === '电视机'" src="../../static/images/TV_icon.png">
<img v-if="item.goodtype === '显示器'" src="../../static/images/xianshi_icon.png">
<div class="itemLeft">
<p class="itemName">[{{item.goodtype}}] {{item.name}}</p>
<p>资产号:{{item.num}}</p>
<p>存放地点:{{item.city}}</p>
</div>
<i v-if="item.isAdd === false" class="addGood" @click="addGood"></i>
<i v-else class="minusGood"></i>
</li>
理想效果
点击途中i标签能获取到这个li标签的index值
还请各位大神帮忙解答!!谢谢!!