Skip to content

Commit 785a2f1

Browse files
committed
feat: support global registration as a Nuxt 3 Module (#32)
1 parent 7c6bd0e commit 785a2f1

File tree

10 files changed

+1140
-1015
lines changed

10 files changed

+1140
-1015
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ TODOs.md
99
.idea
1010
.eslintcache
1111
.env.*
12+
.vitepress/cache

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,29 @@ const value = ref()
438438
</script>
439439
```
440440

441-
#### Global Registration
441+
#### Global Registration as a Module
442+
443+
```ts
444+
// nuxt.config.ts
445+
446+
export default defineNuxtConfig({
447+
modules: ['json-editor-vue/nuxt'],
448+
})
449+
```
450+
451+
```vue
452+
<template>
453+
<client-only>
454+
<JsonEditorVue v-model="value" />
455+
</client-only>
456+
</template>
457+
458+
<script setup>
459+
const value = ref()
460+
</script>
461+
```
462+
463+
#### Global Registration as a Plugin
442464

443465
```ts
444466
// ~/plugins/JsonEditorVue.client.ts

demo/nuxt3/nuxt.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// https://v3.nuxtjs.org/api/configuration/nuxt.config
22
export default defineNuxtConfig({
3-
3+
modules: ['json-editor-vue/nuxt'],
44
})

demo/nuxt3/package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@
99
"postinstall": "nuxt prepare"
1010
},
1111
"dependencies": {
12-
"json-editor-vue": "latest",
13-
"vanilla-jsoneditor": "latest"
12+
"json-editor-vue": "^0.10.2",
13+
"vanilla-jsoneditor": "^0.11.4"
1414
},
1515
"devDependencies": {
16-
"nuxt": "rc"
16+
"@vue/runtime-core": "^3.2.45",
17+
"@vue/server-renderer": "^3.2.45",
18+
"nuxt": "^3.0.0",
19+
"vue": "^3.2.45",
20+
"vue-bundle-renderer": "^1.0.0"
1721
}
1822
}

0 commit comments

Comments
 (0)