1.reactive
-
Reactive is a proxy that transforms an object into a reactive object, which is the same as vue2’s obServerable
-
In VUe2: is done with data hijacking
- In VUE3: done by proxy
2.readonly
- Plain objects such as ractive and ref can be readOnly, which can only be accessed and cannot be changed
3.ref
- If it is passed a normal value, it is a normal ref, similar to the ref in React. Ref has only one property, value. The initial value is the value you set, and you can reassign it
- If an object is passed in, it wraps the value in Reactive as a reactive object
- When setup returns the ref, it automatically adds it to the template context. It automatically takes the ref. Value out of the context, so you don’t need to use the.value
- When a ref is configured to a reactive, you don’t need a.value, you can use it because it does that automatically.
- If a new ref is assigned to an old ref, the new ref overwrites the old ref
- If ref is placed in a native set, map, etc., it is not automatically expanded and you need to manually call.value to get the value.