Skip to content

Commit 33ee76a

Browse files
committed
docs: prefer useTemplateRef over ref for vue@^3.5
1 parent dbc5cb8 commit 33ee76a

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -1020,9 +1020,12 @@ Including the boolean properties of svelte-jsoneditor like `readOnly` with no va
10201020

10211021
```vue
10221022
<script setup>
1023-
import { onMounted, ref } from 'vue'
1023+
import { onMounted, useTemplateRef } from 'vue'
10241024
1025-
const jsonEditorVueRef = ref()
1025+
// Vue ≥ v3.5
1026+
const jsonEditorVueRef = useTemplateRef('jsonEditorVueRef')
1027+
// Vue < v3.5
1028+
// const jsonEditorVueRef = ref()
10261029
10271030
onMounted(() => {
10281031
jsonEditorVueRef.value.jsonEditor.focus()

docs/README.zh-CN.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -1018,9 +1018,12 @@ import { Mode } from 'vanilla-jsoneditor'
10181018

10191019
```vue
10201020
<script setup>
1021-
import { onMounted, ref } from 'vue'
1021+
import { onMounted, useTemplateRef } from 'vue'
10221022
1023-
const jsonEditorVueRef = ref()
1023+
// Vue ≥ v3.5
1024+
const jsonEditorVueRef = useTemplateRef('jsonEditorVueRef')
1025+
// Vue < v3.5
1026+
// const jsonEditorVueRef = ref()
10241027
10251028
onMounted(() => {
10261029
jsonEditorVueRef.value.jsonEditor.focus()

0 commit comments

Comments
 (0)