File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 1
1
import { createApp } from 'vue'
2
2
import App from './App.vue'
3
3
import './index.css'
4
- import 'vant/lib/index.css'
5
4
6
5
createApp ( App ) . mount ( '#app' )
Original file line number Diff line number Diff line change 1
1
import { ComponentResolver } from '../types'
2
+ import { kebabCase } from '../utils'
3
+
4
+ export interface VantResolverOptions {
5
+ /**
6
+ * import style along with components
7
+ *
8
+ * @default true
9
+ */
10
+ importStyle ?: boolean
11
+ }
2
12
3
13
/**
4
14
* Resolver for Vant
5
15
*
6
16
* @link https://github.com/youzan/vant
7
17
*/
8
- export const VantResolver = ( ) : ComponentResolver => ( name : string ) => {
9
- if ( name . startsWith ( 'Van' ) )
10
- return { importName : name . slice ( 3 ) , path : 'vant' }
18
+ export const VantResolver = ( options : VantResolverOptions = { } ) : ComponentResolver => ( name : string ) => {
19
+ const { importStyle = true } = options
20
+ if ( name . startsWith ( 'Van' ) ) {
21
+ const partialName = name . slice ( 3 )
22
+ return {
23
+ importName : partialName ,
24
+ path : 'vant/es' ,
25
+ sideEffects : importStyle ? `vant/es/${ kebabCase ( partialName ) } /style` : undefined ,
26
+ }
27
+ }
11
28
}
You can’t perform that action at this time.
0 commit comments