`You should use slots` when using components and json files
See original GitHub issueEnvironment
- Operating System:
Windows_NT
- Node Version:
v16.15.0
- Nuxt Version:
3.0.0-rc.3
- Package Manager:
yarn@1.22.5
- Builder:
vite
- User Config:
meta
,css
,modules
,build
,vite
,router
,publicRuntimeConfig
,content
,tailwindcss
- Runtime Modules:
@nuxt/content@2.0.0
,@nuxtjs/tailwindcss@5.1.2
,@vueuse/nuxt@8.5.0
,vue-plausible@1.3.1
- Build Modules:
-
Reproduction
Use the content-wind template and create a test.json
in /content
with one of the 2 following contents:
{
"title": "Test",
"description": "a test description"
}
or
{
"title": "Test",
"description": "a test description",
"body": {
"type": "root",
"children": [
{
"type": "element",
"tag": "h1",
"props": {
"id": "title"
},
"children": [
{
"type": "text",
"value": "title"
}
]
}
]
}
}
Then go to http://localhost:3000/test
Describe the bug
I expect the content but I get the following error rendered by the component:
{
"message": "You should use slots with <ContentRenderer>",
"value": {
"_path": "/test",
"_draft": false,
"_partial": false,
"title": "Test",
"description": "a test description",
"excerpt": {
"type": "root",
"children": [
{
"type": "element",
"tag": "h1",
"props": {
"id": "title"
},
"children": [
{
"type": "text",
"value": "title"
}
]
}
]
},
"body": {
"type": "root",
"children": [
{
"type": "element",
"tag": "h1",
"props": {
"id": "title"
},
"children": [
{
"type": "text",
"value": "title"
}
]
}
],
"toc": {
"title": "",
"searchDepth": 2,
"depth": 2,
"links": []
}
},
"_id": "content:2.test.json",
"_type": "json",
"_source": "content",
"_file": "2.test.json",
"_extension": "json"
},
"excerpt": false,
"tag": "div"
}
Same with ContentDoc
Additional context
No response
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:4
- Comments:20 (3 by maintainers)
Top Results From Across the Web
Working with Slots and Web Components - Raymond Camden
A look at slots and how they work with web components. ... Obviously, the use of slots versus arguments will change on a...
Read more >Vue.js simplified: Components, props, and slots
This simole guide shows you how to use components, props, and slots to make writing code in Vue.js easier, cleaner, and faster.
Read more >Using slots in Vue js - James Doyle
If you are working with server-rendered apps, using Vue slots can help you create more reusable and flexible components.
Read more >Understand the components.json File and Format
Each component has an "id" property, which must be unique. This property is used to distinguish between components with the same "type" ....
Read more >Component Slots - A Vue.js Lesson From our Vue.js Course
If you need to pass HTML to your components, use slots. If you need to pass data, use props. Important Note. Since Vue.js...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Unfortunately, I am seeing the same error even if I serve
.output/public
ordist
directly.I tried changing my catch-all page so that the
<ContentDoc>
component uses slots, using the code below, pulled directly from the <ContentDoc> api page:After doing this, I’m still getting essentially the same error, but now it is complaining about the lack of slot usage in
<ContentRenderer>
:I too was having issues with CloudFront. Adding an adjusted behavior for
/api/*
seems to have also helped, but I did a clean node_modules install and lost my modification (posted above) and things stopped working again, once I restored the change, things seem to work as expected (mostly)