Skip to content

Commit

Permalink
feat: support global registration as a Nuxt 3 Module (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
cloydlau committed Dec 17, 2022
1 parent 7c6bd0e commit 785a2f1
Show file tree
Hide file tree
Showing 10 changed files with 1,140 additions and 1,015 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ TODOs.md
.idea
.eslintcache
.env.*
.vitepress/cache
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,29 @@ const value = ref()
</script>
```

#### Global Registration
#### Global Registration as a Module

```ts
// nuxt.config.ts

export default defineNuxtConfig({
modules: ['json-editor-vue/nuxt'],
})
```

```vue
<template>
<client-only>
<JsonEditorVue v-model="value" />
</client-only>
</template>
<script setup>
const value = ref()
</script>
```

#### Global Registration as a Plugin

```ts
// ~/plugins/JsonEditorVue.client.ts
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion demo/nuxt3/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({

modules: ['json-editor-vue/nuxt'],
})
10 changes: 7 additions & 3 deletions demo/nuxt3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
"postinstall": "nuxt prepare"
},
"dependencies": {
"json-editor-vue": "latest",
"vanilla-jsoneditor": "latest"
"json-editor-vue": "^0.10.2",
"vanilla-jsoneditor": "^0.11.4"
},
"devDependencies": {
"nuxt": "rc"
"@vue/runtime-core": "^3.2.45",
"@vue/server-renderer": "^3.2.45",
"nuxt": "^3.0.0",
"vue": "^3.2.45",
"vue-bundle-renderer": "^1.0.0"
}
}
Loading

0 comments on commit 785a2f1

Please sign in to comment.