feat: add isGlobalElement option

This commit is contained in:
zhiyuanzmj 2024-11-27 10:09:03 +08:00
parent 1d6003c043
commit 041d15cff2
2 changed files with 5 additions and 1 deletions

View File

@ -20,6 +20,8 @@ export interface VueJSXPluginOptions {
mergeProps?: boolean;
/** configuring custom elements */
isCustomElement?: (tag: string) => boolean;
/** configuring global elements */
isGlobalElement?: (tag: string) => boolean;
/** enable object slots syntax */
enableObjectSlots?: boolean;
/** Replace the function used when compiling JSX expressions */

View File

@ -109,7 +109,9 @@ export const getTag = (
? t.identifier(name)
: state.opts.isCustomElement?.(name)
? t.stringLiteral(name)
: t.callExpression(createIdentifier(state, 'resolveComponent'), [
: state.opts.isGlobalElement?.(name)
? t.identifier(name)
: t.callExpression(createIdentifier(state, 'resolveComponent'), [
t.stringLiteral(name),
]);
}