-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat: added frontmatter props #57
base: main
Are you sure you want to change the base?
Conversation
Run & review this pull request in StackBlitz Codeflow. |
I am not sure if we should expose everything in the frontmatter to be props. This could lead to implicit and unexpected results as we are mixing different concepts as a single object. I would imagine something like: <HelloWorld :frontmatter-merge="{ name: 'My Awesome App' }" /> and <HelloWorld :frontmatter-replace="{ name: 'My Awesome App' }" /> might be more explicit and less conflicting |
Hi @antfu. This is a great idea. I completely agree with you. It will be more explicit for users and allow for additional props to be added in the future. Do you think Could you please suggest the prop name you prefer, Let me know, and I’ll update my code as soon as possible. |
I was thinking to have |
You're not over-engineering it; I just missed the point that both behaviors might be necessary. Let me check my understanding:
In my opinion, Perhaps we could start with This is just my suggestion. Please let me know your suggestion—I'm happy to follow your decision. |
Yeah, that's exactly what I mean. The
|
I understand. I will update my code to include both |
@antfu I've updated my code with |
Description
I changed the frontmatter from a variable to defineProps with default values.
Now, we can override the frontmatter value by passing props to the component.
The current frontmatter value will be default props value.
Here is an example:
Linked Issues
Here is the related issue: #45
Additional context
For now, I made it support Vue 3. If you want me to continue this feature, I will make for support Vue 2.
If you have any feedback or suggestions, please let me know.