mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 01:15:58 +00:00
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:
parent
83a959a67b
commit
03d33dfdef
@ -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-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-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-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) |
|
| `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) |
|
||||||
|
5
examples/with-plugins/app.vue
Normal file
5
examples/with-plugins/app.vue
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<template>
|
||||||
|
<NuxtExampleLayout example="with-plugins" show-tips>
|
||||||
|
<div>{{ $myPlugin() }}</div>
|
||||||
|
</NuxtExampleLayout>
|
||||||
|
</template>
|
7
examples/with-plugins/nuxt.config.ts
Normal file
7
examples/with-plugins/nuxt.config.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { defineNuxtConfig } from 'nuxt3'
|
||||||
|
|
||||||
|
export default defineNuxtConfig({
|
||||||
|
modules: [
|
||||||
|
'@nuxt/ui'
|
||||||
|
]
|
||||||
|
})
|
13
examples/with-plugins/package.json
Normal file
13
examples/with-plugins/package.json
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
7
examples/with-plugins/plugins/my-plugin.ts
Normal file
7
examples/with-plugins/plugins/my-plugin.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export default defineNuxtPlugin((/* nuxtApp */) => {
|
||||||
|
return {
|
||||||
|
provide: {
|
||||||
|
myPlugin: () => 'String generated from my auto-imported plugin!'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
3
examples/with-plugins/tsconfig.json
Normal file
3
examples/with-plugins/tsconfig.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": "./.nuxt/tsconfig.json"
|
||||||
|
}
|
@ -10755,6 +10755,15 @@ __metadata:
|
|||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
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":
|
"example-with-wasm@workspace:examples/with-wasm":
|
||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "example-with-wasm@workspace:examples/with-wasm"
|
resolution: "example-with-wasm@workspace:examples/with-wasm"
|
||||||
|
Loading…
Reference in New Issue
Block a user