Evan You 10 лет назад
Родитель
Сommit
767b95eb76
3 измененных файлов с 5 добавлено и 8 удалено
  1. 3 2
      src/directives/for.js
  2. 1 3
      src/fragment/multi.js
  3. 1 3
      src/fragment/single.js

+ 3 - 2
src/directives/for.js

@@ -59,7 +59,8 @@ module.exports = {
     if (key) {
       _.defineReactive(scope, '$key', key)
     }
-    var frag = this.factory.create(host, scope, this.id)
+    var frag = this.factory.create(host, scope)
+    frag.forId = this.id
     this.cacheFrag(value, frag, index, key)
     return frag
   },
@@ -365,7 +366,7 @@ function findPrevFrag (frag, anchor, id) {
   if (!el) return
   var frag = el.__vfrag__
   while (
-    (!frag || frag.id !== id || !frag.inserted) &&
+    (!frag || frag.forId !== id || !frag.inserted) &&
     el !== anchor
   ) {
     el = el.previousSibling

+ 1 - 3
src/fragment/multi.js

@@ -7,14 +7,12 @@ var transition = require('../transition')
  * @param {Node} node
  * @param {Function} unlink
  * @param {Object} [scope]
- * @param {String} [id] - v-for id
  */
 
-function MultiFragment (frag, unlink, scope, id) {
+function MultiFragment (frag, unlink, scope) {
   this.start = this.node = _.createAnchor('fragment-start')
   this.end = _.createAnchor('fragment-end')
   this.node.__vfrag__ = this
-  this.id = id
   this.reused = false
   this.inserted = false
   this.nodes = _.toArray(frag.childNodes)

+ 1 - 3
src/fragment/single.js

@@ -8,14 +8,12 @@ var transition = require('../transition')
  * @param {Node} node
  * @param {Function} unlink
  * @param {Object} [scope]
- * @param {String} [id] - v-for id
  */
 
-function SingleFragment (node, unlink, scope, id) {
+function SingleFragment (node, unlink, scope) {
   this.reused = false
   this.node = node
   node.__vfrag__ = this
-  this.id = id
   this.scope = scope
   this.unlink = unlink
   this.inserted = false