web123456

Vue Classic Interview Questions: The Difference between Vue2 and Vue3

How to choose ref and reactive

  • Ref function is preferred because ref function can handle simple data types or complex types, and is often used to define responsive data in data types.

    Ref features: When obtaining or modifying values ​​in the code, you need to add .value, but it is not required in the template template.

  • reactive is often used to define complex data types as reactive data

    Features: No .value is required. If you know clearly what attributes are in the object for a long time, use reactive