el-popover placement=bottom width=245 trigger=hover v-for=item index in uploadRes template #reference el-tag round color=#ffffff closable disable-transitions=false cl
在@close事件中无法直接访问v-for中的索引index是因为它不是在同一作用域中。可以使用闭包来解决这个问题,将index作为参数传递给handleClose函数,如下所示:
@close="handleClose(index)"
然后在handleClose函数中接收index作为参数:
handleClose(index) { // 使用index做一些操作 }
原文地址: https://www.cveoy.top/t/topic/cHzn 著作权归作者所有。请勿转载和采集!