诗号:六道同坠,魔劫万千,引渡如来。

/img/bdx/yiyeshu-001.jpg

本系列为 vue-next 源码分析系列的旁系分支,主要目的在于对 vue3 源码中的一些细节进 行分析。比如: PatchFlags, ShapeFlags, 等等

PatchFlags.BAIL

使用:

1
2
3
4
5
6
// renderer > patch()
// transition 组件中标记为 BAIL 类型,需要进行 full-diff
if (n2.patchFlag === PatchFlags.BAIL) {
  optimized = false;
  n2.dynamicChildren = null;
}

设值:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
// components>BaseTranstion.ts > getTransitionRawChildren()
// #1126 if a transition children list contains multiple sub fragments, these
// fragments will be merged into a flat children array. Since each v-for
// fragment may contain different static bindings inside, we need to de-op
// these children to force full diffs to ensure correct behavior.
if (keyedFragmentCount > 1) {
  for (let i = 0; i < ret.length; i++) {
    ret[i].patchFlag = PatchFlags.BAIL;
  }
}

// components>TransitionGroup.ts > ....
// TODO