Просмотр исходного кода

deal with common issue when used with Sortable (fix #2145)

Evan You 10 лет назад
Родитель
Сommit
6993cfcdc5
1 измененных файлов с 7 добавлено и 0 удалено
  1. 7 0
      src/directives/public/for.js

+ 7 - 0
src/directives/public/for.js

@@ -358,6 +358,13 @@ const vFor = {
    */
 
   move: function (frag, prevEl) {
+    // fix a common issue with Sortable:
+    // if prevEl doesn't have nextSibling, this means it's
+    // been dragged after the end anchor. Just re-position
+    // the end anchor to the end of the container.
+    if (!prevEl.nextSibling) {
+      this.end.parentNode.appendChild(this.end)
+    }
     frag.before(prevEl.nextSibling, false)
   },