vue 3.0 New Features

Performance Optimization

  • object.defineProperty --> Proxy

  • virtual DOM reconstruction (twice as fast than 2.5) [and the size of the template -> and the number of dynamic content in a template-related]

  1. Tradition: the component update, you need to recreate the entire vdom tree, then traverse carried out diff, update

  2. The new update strategy: block tree

  1. Distinguish between static and dynamic node node

  2. Dynamic instruction node (v-if, v-for, {{name}}, etc.) Update

  • Compile-time optimization

  1. slot as a function of default compiler

  2. vnode create a function to keep the parameters of the agreement

  3. Generating type flag when compiling vnode

 

api

  • Undo class API (better support ts)

  • Use function-based API

    • Contrast react Hooks:

    1. The same logical combination, multiplexing capability

    2. Called only once

      1. Intuition line with js

      2. No closure variable problem

      3. No memory / gc pressure

      4. Inline callback problem always leads to sub-assemblies to update does not exist

Guess you like

Origin www.cnblogs.com/ceceliahappycoding/p/11301451.html
Recommended