初始渲染的过渡

可以通过 appear 特性设置节点在初始渲染的过渡

  1. <transition appear>
  2. <!-- ... -->
  3. </transition>

这里默认和进入/离开过渡一样,同样也可以自定义 CSS 类名。

  1. <transition
  2. appear
  3. appear-class="custom-appear-class"
  4. appear-to-class="custom-appear-to-class" (2.1.8+)
  5. appear-active-class="custom-appear-active-class"
  6. >
  7. <!-- ... -->
  8. </transition>

自定义 JavaScript 钩子:

  1. <transition
  2. appear
  3. v-on:before-appear="customBeforeAppearHook"
  4. v-on:appear="customAppearHook"
  5. v-on:after-appear="customAfterAppearHook"
  6. v-on:appear-cancelled="customAppearCancelledHook"
  7. >
  8. <!-- ... -->
  9. </transition>

在上面的例子中,无论是 appear 特性还是 v-on:appear 钩子都会生成初始渲染过渡。