chore(examples): add plugins example (#2855)

* chore(examples): add `plugins` example

* Update examples/with-plugins/plugins/my-plugin.ts

Co-authored-by: Daniel Roe <daniel@roe.dev>

* chore(examples): remove unused variable

* fix: updates post-review

* Update examples/with-plugins/plugins/my-plugin.ts

Co-authored-by: Daniel Roe <daniel@roe.dev>
Co-authored-by: pooya parsa <pyapar@gmail.com>
This commit is contained in:
Sylvain Marroufin 2022-01-24 12:33:38 +01:00 committed by GitHub
parent 83a959a67b
commit 03d33dfdef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 45 additions and 0 deletions

View File

@ -14,4 +14,5 @@
| `with-composables` | [GitHub](https://github.com/nuxt/framework/tree/main/examples/with-composables) | [Play Online](https://stackblitz.com/github/nuxt/framework/tree/main/examples/with-composables?file=app.vue&terminal=dev) |
| `with-layouts` | [GitHub](https://github.com/nuxt/framework/tree/main/examples/with-layouts) | [Play Online](https://stackblitz.com/github/nuxt/framework/tree/main/examples/with-layouts?file=app.vue&terminal=dev) |
| `with-pages` | [GitHub](https://github.com/nuxt/framework/tree/main/examples/with-pages) | [Play Online](https://stackblitz.com/github/nuxt/framework/tree/main/examples/with-pages?file=app.vue&terminal=dev) |
| `with-plugins` | [GitHub](https://github.com/nuxt/framework/tree/main/examples/with-plugins) | [Play Online](https://stackblitz.com/github/nuxt/framework/tree/main/examples/with-plugins?file=app.vue&terminal=dev) |
| `with-wasm` | [GitHub](https://github.com/nuxt/framework/tree/main/examples/with-wasm) | [Play Online](https://stackblitz.com/github/nuxt/framework/tree/main/examples/with-wasm?file=app.vue&terminal=dev) |

View File

@ -0,0 +1,5 @@
<template>
<NuxtExampleLayout example="with-plugins" show-tips>
<div>{{ $myPlugin() }}</div>
</NuxtExampleLayout>
</template>

View File

@ -0,0 +1,7 @@
import { defineNuxtConfig } from 'nuxt3'
export default defineNuxtConfig({
modules: [
'@nuxt/ui'
]
})

View File

@ -0,0 +1,13 @@
{
"name": "example-with-plugins",
"private": true,
"scripts": {
"build": "nuxi build",
"dev": "nuxi dev",
"start": "nuxi preview"
},
"devDependencies": {
"@nuxt/ui": "npm:@nuxt/ui-edge@latest",
"nuxt3": "latest"
}
}

View File

@ -0,0 +1,7 @@
export default defineNuxtPlugin((/* nuxtApp */) => {
return {
provide: {
myPlugin: () => 'String generated from my auto-imported plugin!'
}
}
})

View File

@ -0,0 +1,3 @@
{
"extends": "./.nuxt/tsconfig.json"
}

View File

@ -10755,6 +10755,15 @@ __metadata:
languageName: unknown
linkType: soft
"example-with-plugins@workspace:examples/with-plugins":
version: 0.0.0-use.local
resolution: "example-with-plugins@workspace:examples/with-plugins"
dependencies:
"@nuxt/ui": "npm:@nuxt/ui-edge@latest"
nuxt3: latest
languageName: unknown
linkType: soft
"example-with-wasm@workspace:examples/with-wasm":
version: 0.0.0-use.local
resolution: "example-with-wasm@workspace:examples/with-wasm"