File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change 1- import { queryCollection , useAsyncData } from '@nuxt/content'
2-
3- export default function ( ) {
4- async function fetchMenuItems ( menu ) {
1+ export default function useMenuItems ( ) {
2+ async function fetchMenuItems ( menu : string ) {
53 return await queryCollection ( 'menu' )
64 . where ( 'stem' , '=' , `menu/${ menu } ` )
75 . first ( )
@@ -10,7 +8,7 @@ export default function () {
108 return await queryCollection ( 'menu' ) . all ( )
119 }
1210
13- async function fetchMenuItemsAsync ( menu ) {
11+ async function fetchMenuItemsAsync ( menu : string ) {
1412 const path = `menu/${ menu } `
1513 return await useAsyncData (
1614 path ,
Original file line number Diff line number Diff line change 1+ import { defineCollection , defineContentConfig , z } from '@nuxt/content'
2+
3+ export default defineContentConfig ( {
4+ collections : {
5+ menu : defineCollection ( {
6+ source : 'menu/**.yml' ,
7+ type : 'data' ,
8+ schema : z . object ( {
9+ items : z . array (
10+ z . object ( {
11+ title : z . string ( ) ,
12+ path : z . string ( ) ,
13+ } ) ,
14+ ) ,
15+ } ) ,
16+ } ) ,
17+ } ,
18+ } )
You can’t perform that action at this time.
0 commit comments