11import type { ComponentInfo , ComponentResolver , SideEffectsInfo } from '../../types'
2- import { camelCase } from '../utils'
32
43const matchComponents = [
54 {
@@ -100,6 +99,10 @@ const layerRE = /^(layer|LayLayer)$/
10099const iconsRE = / ^ ( [ A - Z ] [ \w ] + I c o n | L a y I c o n ) $ /
101100let libName = '@layui/layui-vue'
102101
102+ function lowerCamelCase ( str : string ) {
103+ return str . charAt ( 0 ) . toLowerCase ( ) + str . slice ( 1 )
104+ }
105+
103106function getSideEffects ( importName : string , options : LayuiVueResolverOptions ) : SideEffectsInfo | undefined {
104107 const { importStyle = 'css' } = options
105108 if ( ! importStyle )
@@ -108,7 +111,7 @@ function getSideEffects(importName: string, options: LayuiVueResolverOptions): S
108111 if ( libName !== '@layui/layui-vue' )
109112 return `${ libName } /lib/index.css`
110113
111- let styleDir : string | undefined = camelCase ( importName . slice ( 3 ) ) // LayBackTop -> backTop
114+ let styleDir : string | undefined = lowerCamelCase ( importName . slice ( 3 ) ) // LayBackTop -> backTop
112115 for ( const item of matchComponents ) {
113116 if ( item . pattern . test ( importName ) ) {
114117 styleDir = item . styleDir
@@ -136,7 +139,7 @@ function resolveComponent(importName: string, options: LayuiVueResolverOptions):
136139 name = importName
137140 libName = '@layui/layer-vue'
138141 }
139- else if ( importName . match ( layuiRE ) ) {
142+ else if ( importName . match ( layuiRE ) && ! importName . match ( iconsRE ) ) {
140143 name = importName
141144 libName = '@layui/layui-vue'
142145 }
0 commit comments