-
Notifications
You must be signed in to change notification settings - Fork 23
feat: add slot support in jsx render function #101
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Props for the quick work.
const renderValuePath = renderPath[0].get('value') | ||
const renderValuePath = bt.isObjectProperty(renderPath[0].node) | ||
? renderPath[0].get('value') | ||
: renderPath[0] | ||
recast.visit(renderValuePath, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you can return JSX from both methods and computed properties (and maybe even data?), I think we should visit the full Vue object here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'll make the PR bigger though since we need to add all the relevant tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is a good idea. In this case, you should create another handler so that not to polute the render function handler already present.
@@ -95,6 +95,8 @@ export default { | |||
const { sortKey, capitalize } = this | |||
return ( | |||
<table class="grid"> | |||
{/** @slot Use this slot header */} | |||
<slot name="header" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps also add a method/computed property with the footer slot, and then include it below. See my comment above
Hello @b12f, You review is very appreciated. :-) |
Co-Authored-By: elevatebart <ledouxb@me.com>
Feel free to merge, I'll look at how we might be able to do full component parsing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another way to do the comment expression find is functionally: slice > reverse > find
.
🎉 This PR is included in version 3.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
fix #100