Skip to content

Commit

Permalink
feat: 添加新的案例
Browse files Browse the repository at this point in the history
  • Loading branch information
WangZhenHao committed May 18, 2024
1 parent 2a27009 commit 3e6b8e8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/property/refs-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ export const publicPropertiesMap: PublicPropertiesMap =

- 在定义动态的:ref 如:`<test :ref="testRef1"></test>`,这种写法一般不推荐,如果想要获取到实例,必须要`const testRef1 = ref("testRef1")`

或者`const testRef1 = ref("testRef1Value");const testRef1Value = ref()`,用ref api定义`testRef1Value`去承接组件实例的赋值

既变量名和值要一样。因为`setRef函数`里面,赋值组件实例执行了`setupState[ref] = value`

- 定义静态ref,如`<test ref="testRef1"></test>`,在composition api中定义任何值都没有问题 `const testRef1 = ref("任何值")`
Expand Down

0 comments on commit 3e6b8e8

Please sign in to comment.