File tree Expand file tree Collapse file tree 1 file changed +28
-2
lines changed
Expand file tree Collapse file tree 1 file changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -178,6 +178,12 @@ Native is only available for Vue components.
178178
179179### HTML / Component ref
180180
181+ #### Vue ≤ 2.6
182+
183+ Due to the limitation, using ref is a little different from to Vue 3.
184+
185+ You can check [ this] ( https://github.com/vuejs/composition-api#limitations ) out for more information.
186+
181187``` tsx
182188import { ComponentPublicInstance , defineComponent , onMounted } from ' @vue/composition-api'
183189
@@ -206,9 +212,29 @@ const Wrapper = defineComponent({
206212})
207213```
208214
209- Due to limitations, using ref is a little different from to Vue 3.
215+ #### Vue 2.7+
210216
211- You can check [ this] ( https://github.com/vuejs/composition-api#limitations ) out for more information.
217+ Vue 2.7 has its built-in composition API support, and the behavior acts as the same as Vue 3.
218+
219+ ``` tsx
220+ import { ref , defineComponent } from ' vue'
221+
222+ const Example = defineComponent ({
223+ setup () {
224+ const dogeRef = ref <HTMLElement >()
225+
226+ onMounted (() => {
227+ console .log (dogeRef .value )
228+ })
229+
230+ return () => (
231+ <div >
232+ <div ref = { dogeRef } >Wow very doge</div >
233+ </div >
234+ )
235+ }
236+ })
237+ ```
212238
213239### Slot
214240
You can’t perform that action at this time.
0 commit comments