Skip to content

Commit

Permalink
fix: support Vue.use when install components
Browse files Browse the repository at this point in the history
  • Loading branch information
AngusFu committed Feb 22, 2019
1 parent 471dd82 commit 8862635
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/scripts/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ export default {
const keys = reqs.keys()
for (let i = 0; i < keys.length; i++) {
const module = getModule(reqs(keys[i]))

// turn components' names to Pascal Case
// so that we can use markups like `<CSelect />`
// which would meet the needs of those PascalCase fans
// TODO
// we will turn all `name` fields in SFC into pacal case in the future
module.name && Vue.component(pascalCase(module.name), module)
if (typeof module.install === 'function') {
Vue.use(module)
} else if (module && module.name) {
// turn components' names to Pascal Case
// so that we can use markups like `<CSelect />`
// which would meet the needs of those PascalCase fans
// TODO
// we will turn all `name` fields in SFC into pacal case in the future
Vue.component(pascalCase(module.name), module)
}
}
}
}
Expand Down

0 comments on commit 8862635

Please sign in to comment.