当前位置: 首页 > Web前端 > HTML5

动态添加并获得ref

时间:2023-04-05 22:06:01 HTML5

1。在项目中使用vant的van-swipe-cell,需要动态获取当前ref值2。具体方法获取openswipCell(event,item){this.$refs[`crewData${item.id}`][0].open('right')},比较深入,因为点击需要在循环体内实现(也就是在parentbox)`openswipCell(event,item){event.stopPropagation();如果(this.$refs[`crewData${item.id}`][0].offset){this.$refs[`crewData${item.id}`][0].close();返回;}this.$refs[`crewData${item.id}`][0].open('right')},`