Skip to content

Commit 7f9ae30

Browse files
committed
chore: add ui-pro and i18n examples
1 parent c8d8848 commit 7f9ae30

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1406
-0
lines changed

examples/basic/.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Nuxt dev/build outputs
2+
.output
3+
.data
4+
.nuxt
5+
.nitro
6+
.cache
7+
dist
8+
9+
# Node dependencies
10+
node_modules
11+
12+
# Logs
13+
logs
14+
*.log
15+
16+
# Misc
17+
.DS_Store
18+
.fleet
19+
.idea
20+
21+
# Local env files
22+
.env
23+
.env.*
24+
!.env.example
25+
26+
pnpm-lock.yaml

examples/basic/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
shamefully-hoist=true

examples/basic/README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Nuxt Content Starter
2+
3+
Look at the [Nuxt Content documentation](https://content3.nuxt.dev) to learn more.
4+
5+
## Setup
6+
7+
Make sure to install dependencies:
8+
9+
```bash
10+
# npm
11+
npm install
12+
13+
# pnpm
14+
pnpm install
15+
16+
# yarn
17+
yarn install
18+
19+
# bun
20+
bun install
21+
```
22+
23+
## Development Server
24+
25+
Start the development server on `http://localhost:3000`:
26+
27+
```bash
28+
# npm
29+
npm run dev
30+
31+
# pnpm
32+
pnpm dev
33+
34+
# yarn
35+
yarn dev
36+
37+
# bun
38+
bun run dev
39+
```
40+
41+
## Production
42+
43+
Build the application for production:
44+
45+
```bash
46+
# npm
47+
npm run build
48+
49+
# pnpm
50+
pnpm build
51+
52+
# yarn
53+
yarn build
54+
55+
# bun
56+
bun run build
57+
```
58+
59+
Locally preview production build:
60+
61+
```bash
62+
# npm
63+
npm run preview
64+
65+
# pnpm
66+
pnpm preview
67+
68+
# yarn
69+
yarn preview
70+
71+
# bun
72+
bun run preview
73+
```
74+
75+
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<template>
2+
<div>
3+
<h1>Counter: {{ count }}</h1>
4+
<button
5+
class="mr-2"
6+
@click="increment"
7+
>
8+
Increment
9+
</button>
10+
<button @click="decrement">
11+
Decrement
12+
</button>
13+
</div>
14+
</template>
15+
16+
<script setup lang="ts">
17+
import { ref } from 'vue'
18+
19+
const count = ref(0)
20+
21+
const increment = () => {
22+
count.value++
23+
}
24+
25+
const decrement = () => {
26+
count.value--
27+
}
28+
</script>
29+
30+
<style scoped>
31+
button {
32+
margin: 5px;
33+
}
34+
</style>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<script setup lang="ts">
2+
const route = useRoute()
3+
4+
const { data: page } = await useAsyncData('page-' + route.path, () => {
5+
return queryCollection('content').path(route.path).first()
6+
})
7+
if (!page.value) {
8+
throw createError({ statusCode: 404, statusMessage: 'Page not found', fatal: true })
9+
}
10+
</script>
11+
12+
<template>
13+
<ContentRenderer
14+
v-if="page"
15+
:value="page"
16+
/>
17+
</template>
4.19 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

examples/basic/content.config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { defineCollection } from '@nuxt/content'
2+
3+
export const collections = {
4+
content: defineCollection({
5+
type: 'page',
6+
source: '**',
7+
}),
8+
}

examples/basic/content/index.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Welcome to Nuxt Content starter
2+
3+
## Manage your contents
4+
5+
Create new pages or modify the existing ones in `content/` directory.
6+
7+
## Query & Render pages
8+
9+
You can find an example of querying contents and rendering them in `app/pages/[...slug].vue`
10+
11+
12+
## Fancy to use a Vue component?
13+
14+
::counter
15+
::
16+
17+
:div{style="margin: 2rem 0"}
18+
19+
::div{style="background: orange; font-size: 1.5rem; padding: 10px 20px;"}
20+
Checkout [official docs][docs] to read more about Nuxt Content
21+
::
22+
23+
24+
25+
[docs]: https://content3.nuxt.dev

examples/basic/nuxt.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// https://nuxt.com/docs/api/configuration/nuxt-config
2+
export default defineNuxtConfig({
3+
modules: [
4+
'@nuxt/content',
5+
],
6+
devtools: { enabled: true },
7+
future: {
8+
compatibilityVersion: 4,
9+
},
10+
compatibilityDate: '2024-04-03',
11+
})

0 commit comments

Comments
 (0)