Skip to content

Commit 8058e35

Browse files
committed
chore: jsonEditor.value could be undefined in Vue 2.6 (dev environment)
1 parent 99c66d7 commit 8058e35

File tree

8 files changed

+274
-247
lines changed

8 files changed

+274
-247
lines changed

auto-imports.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ declare global {
3636
const readonly: typeof import('vue')['readonly']
3737
const ref: typeof import('vue')['ref']
3838
const resolveComponent: typeof import('vue')['resolveComponent']
39+
const resolveDirective: typeof import('vue')['resolveDirective']
3940
const shallowReactive: typeof import('vue')['shallowReactive']
4041
const shallowReadonly: typeof import('vue')['shallowReadonly']
4142
const shallowRef: typeof import('vue')['shallowRef']

demo/vue2.6/index.vue

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@
1919
</p>
2020

2121
<br>
22-
<JsonEditorVue
23-
ref="jsonEditorVueRef" v-model="data.value" :mode.sync="data.mode"
24-
:readOnly="data.readOnly"
25-
/>
22+
<JsonEditorVue ref="jsonEditorVueRef" v-model="data.value" :mode.sync="data.mode"
23+
:readOnly="data.readOnly" />
2624

2725
<br>
2826
<p>Mode</p>
@@ -52,7 +50,6 @@ export default {
5250
hasSetup = true
5351
}
5452
55-
const jsonEditorVueRef = ref()
5653
const data = reactive<{
5754
value: any
5855
mode?: Mode
@@ -63,17 +60,18 @@ export default {
6360
readOnly: false,
6461
})
6562
63+
/* const jsonEditorVueRef = ref()
6664
onMounted(() => {
6765
console.log(jsonEditorVueRef.value)
68-
})
66+
}) */
6967
7068
return {
71-
jsonEditorVueRef,
69+
//jsonEditorVueRef,
7270
data,
7371
}
7472
},
7573
mounted() {
76-
console.log(this.$refs.jsonEditorVueRef.jsonEditor.expand)
74+
console.log('expand: ', this.$refs.jsonEditorVueRef.jsonEditor.expand)
7775
},
7876
}
7977
</script>

demo/vue2.7/index.vue

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,17 @@
3232
</div>
3333
</template>
3434

35-
<script setup lang="ts">
35+
<script setup>
3636
import JsonEditorVue from '../../src'
37-
import type { Mode } from '../../src'
3837
39-
const data = reactive<{
40-
value: any
41-
mode?: Mode
42-
readOnly: boolean
43-
}>({
38+
const data = reactive({
4439
value: undefined,
4540
mode: undefined,
4641
readOnly: false,
4742
})
4843
4944
const jsonEditorVueRef = ref()
5045
onMounted(() => {
51-
console.log(jsonEditorVueRef.value.jsonEditor.expand)
46+
console.log('expand: ', jsonEditorVueRef.value.jsonEditor.expand)
5247
})
5348
</script>

demo/vue3/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,6 @@ const data = reactive<{
6565
6666
const jsonEditorVueRef = ref()
6767
onMounted(() => {
68-
console.log(jsonEditorVueRef.value.jsonEditor.expand)
68+
console.log('expand: ', jsonEditorVueRef.value.jsonEditor.expand)
6969
})
7070
</script>

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta charset="UTF-8" />
66
<link rel="icon" href="/favicon.ico" />
77
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8-
<title>{{NAME}} + Vue {{VUE_VERSION}}</title>
8+
<title>Vue {{VUE_VERSION}}</title>
99
</head>
1010

1111
<body>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"lint-staged": "latest",
8383
"lossless-json": "latest",
8484
"typescript": "latest",
85-
"unplugin-auto-import": "0.11.2",
85+
"unplugin-auto-import": "latest",
8686
"vanilla-jsoneditor": "latest",
8787
"vite": "latest",
8888
"vite-plugin-dts": "latest",

0 commit comments

Comments
 (0)