feat: allow VPContent to use custom components#5176
Conversation
commit: |
|
|
||
| function resolveLayout(name: string) { | ||
| const component = resolveComponent(name) | ||
| return typeof component === 'string' ? null : component |
There was a problem hiding this comment.
could've just returned true/false I guess for this use case
|
@brc-dd @shigma
|
|
Hmm, yeah hard to do this without resolveComponent/resolveDynamicComponent. Other alternative I see is doing something like this https://github.com/vueform/vueform/blob/main/src/utils/isComponentRegistered.js#L3, but that will need getCurrentInstance 🫠 We can go back to not supporting the default theme names it if there are issues with the vapor implementation. |
|
|

Description
Currently,
VPContenthardcodes the use ofVPPage,VPHome, andVPDocfor the built-inpage,home, anddoclayouts. Custom layouts only work via<component :is>for non-built-in layout names. This means there is no way to fully override the built-in layout components from a custom theme.This PR uses
resolveComponentto check whether the user has registered a global component matching the layout name (page,home, ordoc). If a matching component is found, VPContent falls through to<component :is>instead of using the built-in component. If no override is registered, the behavior is exactly the same as before.Linked Issues
N/A
Additional Context
N/A
Tip
The author of this PR can publish a preview release by commenting
/publishbelow.