Skip to content

Function: reactive()

ts
function reactive<T>(
   value: T, 
   isShadow: boolean, 
   isReadonly: boolean): T

代理对象值,返回响应式数据

Example

ts
const obj = reactive({name:'张三'});
obj.name = '李四';
console.log(obj.name); //李四

Type Parameters

Type Parameter

T extends object

Parameters

ParameterTypeDefault valueDescription

value

T

undefined

对象值

isShadow

boolean

false

true为深代理,false为浅代理

isReadonly

boolean

false

是否只读

Returns

T