@@ -200,9 +200,9 @@ export interface AntDesignVueResolverOptions {
200
200
*/
201
201
packageName ?: string
202
202
/**
203
- * resolve prefix 'A' ?
203
+ * customize prefix of component
204
204
*/
205
- resolvePrefix ?: boolean
205
+ prefix ?: string
206
206
}
207
207
208
208
function getStyleDir ( compName : string ) : string {
@@ -272,17 +272,18 @@ export function AntDesignVueResolver(options: AntDesignVueResolverOptions = {
272
272
return {
273
273
type : 'component' ,
274
274
resolve : ( name : string ) => {
275
+ // if options.prefix is undefined, then give it a default value 'A'
276
+ options . prefix === undefined && ( options . prefix = 'A' )
275
277
if ( options . resolveIcons && name . match ( / ( O u t l i n e d | F i l l e d | T w o T o n e ) $ / ) ) {
276
278
return {
277
279
name,
278
280
from : '@ant-design/icons-vue' ,
279
281
}
280
282
}
281
- // if options.resolvePrefix is undefined or true,
282
- // then eg.'ALayout' -> 'Layout',
283
- // and use `name` directly in the following content
284
- ( options ?. resolvePrefix === undefined || options . resolvePrefix ) && ( name = name . slice ( 1 ) )
285
- if ( isAntdv ( name ) && ! options ?. exclude ?. includes ( name ) ) {
283
+ let prefix
284
+ // divide component name and prefix
285
+ [ name , prefix ] = [ name . slice ( options . prefix . length ) , name . slice ( 0 , options . prefix . length ) ]
286
+ if ( prefix === options . prefix && isAntdv ( name ) && ! options ?. exclude ?. includes ( name ) ) {
286
287
const { cjs = false , packageName = 'ant-design-vue' } = options
287
288
const path = `${ packageName } /${ cjs ? 'lib' : 'es' } `
288
289
return {
0 commit comments