Zum Inhalt springen
verdict:

Vue 3.6.0-rc.1

preview

note: die Zusammenfassung und die Release Notes sind auf Englisch

note: keine Zusammenfassung für dieses ältere Release

Wir fassen die neueren Releases zusammen. Die originalen Release Notes dieser Version stehen hier unten.

release-notesgithub.com/vuejs/core · 185 Zeilen
  1. Vue 3.6 is now entering the RC phase as we have completed the intended feature set for Vapor Mode.
  2. 3.6 also includes a major refactor of `@vue/reactivity` based on [alien-signals](https://github.com/stackblitz/alien-signals), which significantly improves the reactivity system's performance and memory usage.
  3. For more details about Vapor Mode, see the [About Vapor Mode](#about-vapor-mode) section later in this release note.
  4. ### Bug Fixes
  5. * **hydration:** avoid resolving inherited fallback in forwarded slots ([4c215b5](https://github.com/vuejs/core/commit/4c215b5bd293e18f3a4c62b627a7696016afb982))
  6. * **hydration:** remove adopted SSR DOM for unresolved async setup ([3859af4](https://github.com/vuejs/core/commit/3859af4066edeba647e886decb9b4737d7f371cc))
  7. * **runtime-vapor:** avoid patching invalid VNode slot content ([25f5a8a](https://github.com/vuejs/core/commit/25f5a8ae6ed3df9c4e3fbaed0da32ce0466c5612))
  8. * **runtime-vapor:** clean up detached slot branches ([b41009d](https://github.com/vuejs/core/commit/b41009d41b21c98174b214eebd271d456215d177))
  9. * **runtime-vapor:** defer slot content anchors during hydration ([9b9e4bd](https://github.com/vuejs/core/commit/9b9e4bd6efdbce7de258d27e88155bff657d6ae9))
  10. * **runtime-vapor:** preserve outer pending slot anchors ([4af4bf9](https://github.com/vuejs/core/commit/4af4bf92a46426631ed6323e542227855b2fc86f))
  11. * **runtime-vapor:** preserve slot content anchors during mismatch recovery ([26f90b5](https://github.com/vuejs/core/commit/26f90b58977ee84569b5599700dbe9e864c880a4))
  12. * **runtime-vapor:** preserve v-show transition on vdom child ([#15074](https://github.com/vuejs/core/issues/15074)) ([fe882c9](https://github.com/vuejs/core/commit/fe882c93bb3ec37772126de1cb5c646edb56ace4)), closes [#15073](https://github.com/vuejs/core/issues/15073)
  13. * **runtime-vapor:** preserve vapor slot owner during interop slot dry run ([#15031](https://github.com/vuejs/core/issues/15031)) ([340630e](https://github.com/vuejs/core/commit/340630ea37388e12f176a11cadcbdfe8e55e5912))
  14. * **runtime-vapor:** preserve VNode anchors in dynamic component hydration ([898e2ca](https://github.com/vuejs/core/commit/898e2ca2441ea3ac064f3b38db47a0aa1b7a556d))
  15. * **runtime-vapor:** remove unsafe slot dry runs from vdom interop ([#15089](https://github.com/vuejs/core/issues/15089)) ([3d42cdf](https://github.com/vuejs/core/commit/3d42cdf380b23da000de0ff9d6c3de5d77e0b0d1)), closes [#14793](https://github.com/vuejs/core/issues/14793)
  16. * **runtime-vapor:** reuse hydration anchor candidates ([06778e7](https://github.com/vuejs/core/commit/06778e705aa87e35f6058c575c562c355a365523))
  17. * **vapor:** handle v-if and v-show on transition roots ([#15069](https://github.com/vuejs/core/issues/15069)) ([8f62f2e](https://github.com/vuejs/core/commit/8f62f2e57519dcb80c9b3b42588c77ee6d2b0a2f)), closes [#15068](https://github.com/vuejs/core/issues/15068)
  18. ## About Vapor Mode
  19. Vapor Mode is a new compilation mode for Vue Single-File Components (SFCs) with the goal of reducing baseline bundle size and improving performance.
  20. It is 100% opt-in and supports a subset of existing Vue APIs with mostly identical behavior. Features that depend on VNodes or the component public instance proxy are not available in Vapor components.
  21. Vapor Mode has demonstrated the same level of performance as Solid and Svelte 5 in [third-party benchmarks](https://github.com/krausest/js-framework-benchmark).
  22. ### General Stability Notes
  23. Vapor Mode is feature-complete in Vue 3.6 RC. For now, we recommend using it in the following cases:
  24. - Partial usage in existing apps, such as implementing a performance-sensitive page in Vapor Mode.
  25. - Building small new apps entirely in Vapor Mode.
  26. ## Opting In to Vapor Mode
  27. Vapor Mode supports template-only SFCs and SFCs using `<script setup>`; the Options API is not supported. The following forms are supported:
  28. ```vue
  29. <script setup vapor>
  30. // ...
  31. </script>
  32. ```
  33. `<script vapor>` is shorthand for `<script setup vapor>`:
  34. ```vue
  35. <script vapor>
  36. // ...
  37. </script>
  38. ```
  39. The `vapor` marker can also be placed on the template, enabling Vapor compilation for the entire SFC:
  40. ```vue
  41. <template vapor>
  42. <!-- ... -->
  43. </template>
  44. ```
  45. ## Creating an App and Using VDOM Interop
  46. ### Pure Vapor Applications
  47. Applications composed entirely of Vapor components can use `createVaporApp()`:
  48. ```js
  49. import { createVaporApp } from 'vue'
  50. import App from './App.vue'
  51. createVaporApp(App).mount('#app')
  52. ```
  53. Apps created this way avoid pulling in the Virtual DOM runtime code and allow the baseline bundle size to be drastically reduced.
  54. ### Enabling VDOM Interop
  55. To use Vapor components in a VDOM app instance created via `createApp()`, the `vaporInteropPlugin` must be installed:
  56. ```js
  57. import { createApp, vaporInteropPlugin } from 'vue'
  58. import App from './App.vue'
  59. createApp(App).use(vaporInteropPlugin).mount('#app')
  60. ```
  61. A Vapor app instance can also install `vaporInteropPlugin` to allow VDOM components to be used inside, but this pulls in the VDOM runtime and offsets the benefits of a smaller bundle.
  62. Components authored with render functions or JSX remain VDOM components and also require interop when used in a Vapor application.
  63. When the interop plugin is installed, Vapor and non-Vapor components can be nested inside each other. This currently covers standard props, events, and slots usage, but does not yet account for all possible edge cases. For example, there may still be rough edges when using a VDOM-based component library in Vapor Mode.
  64. In general, we recommend having distinct regions in an app where one rendering mode or the other is used, and avoiding mixed nesting as much as possible.
  65. ## Feature Compatibility
  66. By design, Vapor Mode supports a subset of existing Vue features. For the supported subset, we aim to deliver the same behavior according to the API specifications. The following features are currently unsupported or do not apply to Vapor Mode:
  67. - Options API
  68. - `app.config.globalProperties`
  69. - `getCurrentInstance()` returns `null` in Vapor components
  70. - `@vue:xxx` per-element lifecycle events
  71. - `v-memo`
  72. - Component template refs do not expose properties such as `$el`, `$props`, `$attrs`, `$slots`, and `$refs`
  73. ## Important Usage Considerations
  74. ### Event Delegation and `stopPropagation()`
  75. Vapor delegates eligible events to `document`. Each element stores its own handler, and a single document listener walks the event path and invokes matching handlers.
  76. If any ancestor calls `stopPropagation()`, the event never reaches `document`, and the delegated handler will not run.
  77. The following forms bypass delegation and attach the listener directly to the element:
  78. ```vue
  79. <button @[event]="onClick" />
  80. <button v-bind="{ onClick }" />
  81. <button v-on="{ click: onClick }" />
  82. ```
  83. ### `slots.default()` Is Not a Safe Dry Run
  84. In Vapor, `slots.default()` is not a side-effect-free inspection API. Calling it executes the slot's rendering logic, which may create Blocks and DOM nodes, register reactive effects, and claim existing SSR DOM during hydration.
  85. Do not call a slot to inspect its output before deciding what else to render:
  86. ```vue
  87. <script setup vapor>
  88. import { useSlots } from 'vue'
  89. const slots = useSlots()
  90. const content = slots.default?.()
  91. const showFallback = !content
  92. </script>
  93. <template>
  94. <div v-if="showFallback">Fallback</div>
  95. </template>
  96. ```
  97. Instead, leave slot rendering to the template:
  98. ```vue
  99. <template>
  100. <slot />
  101. </template>
  102. ```
  103. ### Custom Directives Use a Different Interface
  104. Custom directives in Vapor also have a different interface:
  105. ```ts
  106. type VaporDirective = (
  107. node: Element | VaporComponentInstance,
  108. value?: () => any,
  109. argument?: string,
  110. modifiers?: DirectiveModifiers,
  111. ) => (() => void) | void
  112. ```
  113. `value` is a reactive getter that returns the binding value. Reactive effects can be set up using `watchEffect()` and are automatically released when the component unmounts. A directive may also return a cleanup function:
  114. ```ts
  115. const MyDirective = (el, source) => {
  116. watchEffect(() => {
  117. el.textContent = source()
  118. })
  119. return () => console.log('cleanup')
  120. }
  121. ```
  122. ## Behavior Consistency
  123. Vapor Mode attempts to match VDOM Mode behavior as much as possible, but minor inconsistencies may still exist in edge cases because the two rendering modes are fundamentally different. In general, a minor inconsistency is not considered a breaking change unless the behavior has previously been documented.
  124. For stable releases, please refer to [CHANGELOG.md](https://github.com/vuejs/core/blob/main/CHANGELOG.md) for details.
  125. For pre-releases, please refer to [CHANGELOG.md](https://github.com/vuejs/core/blob/minor/CHANGELOG.md) of the `minor` branch.

auf github ansehenimported 2026-09-28 über npm