Skip to content

Commit

Permalink
fix(resolver/tdesign): auto import 'DialogPlugin', 'LoadingPlugin', … (
Browse files Browse the repository at this point in the history
  • Loading branch information
lishaobos authored Jul 18, 2023
1 parent 416f2c6 commit cf67b8c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/resolvers/tdesign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface TDesignResolverOptions {
}

export function TDesignResolver(options: TDesignResolverOptions = {}): ComponentResolver {
const pluginList = ['DialogPlugin', 'LoadingPlugin', 'MessagePlugin', 'NotifyPlugin']
return {
type: 'component',
resolve: (name: string) => {
Expand All @@ -43,8 +44,8 @@ export function TDesignResolver(options: TDesignResolverOptions = {}): Component
}
}

if (name.match(/^T[A-Z]/)) {
const importName = name.slice(1)
if (name.match(/^T[A-Z]/) || pluginList.includes(name)) {
const importName = name.match(/^T[A-Z]/) ? name.slice(1) : name

return {
name: importName,
Expand Down

0 comments on commit cf67b8c

Please sign in to comment.