Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.5k views
in Technique[技术] by (71.8m points)

Vue使用$ref获取Dom的时候,获取的Array的顺序是否有和页面显示的Dom顺序不一致的时候

使用for循环生成的Dom有相同的ref名称,其循环的数组可变,即有可能会有splice和push等操作。
这时使用refs获取Dom得到的数组当中的Dom的顺序是否有可能会和页面显示的Dom的顺序不一致的情况。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

那你循环的时候把index追加到ref后面不就唯一了吗,:ref=test+${index}


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...