-
-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can I inject posts into a Vue component (not layout)? #595
Comments
You'd have to pass the page prop manually, like this: // in your layout file:
<ComponentToc :page="page" /> |
@krmax44 Thanks for the quick reply. Is there a chance that the ability to inject posts into components will be added soon? |
I don't really see a wide use-case for that. Components aren't meant to have page state, but to be page/layout-agnostic. A component usually is something like a button. If you want to create a post component used on the index page, category/tag pages etc. it is meant to be used like this: <BlogPost :title="post.title" :createdAt="post.createdAt" />
<!--- or like this -->
<BlogPost :post="post" /> For page state, layouts are the intended way. |
I have a table of contents component which shows a list of posts. I tried this:
When I check the Vue devtools,
page
does not have any propertyposts
. Is there a way to do this?The text was updated successfully, but these errors were encountered: