2024-07-08
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
effect: Define the response variable.
grammar:let xxx=ref(initial value).
return value: An instance object of RefImpl, referred to as ref object or ref, the value attribute of the ref object is responsive
be careful:
effect: Define a responsive object (don’t use it for basic types, use ref, otherwise an error will be reported).
grammar:let responsive object = reactive(source object).
return value: A Proxy instance object, also known as a responsive object.
be careful: The responsive data defined by reactive is "deep".
effect: Convert each property in a responsive object into a ref object.
Remark: toRefs has the same function as toRef, but toRefs can perform batch conversion.
The syntax is as follows:
import {reactive,toRefs,toRef} from
// 数据
let person = reactive({
name:'张三
age:18
})
let {name,age} = toRefs(person)
let nl = toRef(person,'age')