Skip to content

Commit 8862635

Browse files
committed
fix: support Vue.use when install components
1 parent 471dd82 commit 8862635

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/scripts/components.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@ export default {
1111
const keys = reqs.keys()
1212
for (let i = 0; i < keys.length; i++) {
1313
const module = getModule(reqs(keys[i]))
14-
15-
// turn components' names to Pascal Case
16-
// so that we can use markups like `<CSelect />`
17-
// which would meet the needs of those PascalCase fans
18-
// TODO
19-
// we will turn all `name` fields in SFC into pacal case in the future
20-
module.name && Vue.component(pascalCase(module.name), module)
14+
if (typeof module.install === 'function') {
15+
Vue.use(module)
16+
} else if (module && module.name) {
17+
// turn components' names to Pascal Case
18+
// so that we can use markups like `<CSelect />`
19+
// which would meet the needs of those PascalCase fans
20+
// TODO
21+
// we will turn all `name` fields in SFC into pacal case in the future
22+
Vue.component(pascalCase(module.name), module)
23+
}
2124
}
2225
}
2326
}

0 commit comments

Comments
 (0)