Skip to content

Commit 5fe6e55

Browse files
committed
fix v-ref on v-for when repeated block is a sub-fragment (fix #1850)
1 parent 47bb792 commit 5fe6e55

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/directives/public/for.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,14 @@ function findPrevFrag (frag, anchor, id) {
581581
*/
582582

583583
function findVmFromFrag (frag) {
584-
return frag.node.__vue__ || frag.node.nextSibling.__vue__
584+
let node = frag.node
585+
// handle multi-node frag
586+
if (frag.end) {
587+
while (!node.__vue__ && node !== frag.end && node.nextSibling) {
588+
node = node.nextSibling
589+
}
590+
}
591+
return node.__vue__
585592
}
586593

587594
/**

0 commit comments

Comments
 (0)