Skip to content

Commit ca1f6c3

Browse files
committed
use appropriate component name
1 parent 543ae2f commit ca1f6c3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/register.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@ const hyphenate = ((str: string): string => {
1414

1515
export function register_all_components(vue: typeof Vue, prefix: string) {
1616
for (var k in components) {
17-
vue.component(prefix + '-' + hyphenate(k), components[k])
17+
let opt = components[k]
18+
if (typeof opt === 'function')
19+
opt = opt.options
20+
21+
// clear components so it will have new names
22+
delete opt.components
23+
24+
opt.name = prefix + '-' + hyphenate(k)
25+
vue.component(opt.name, vue.extend(opt))
1826
}
1927
}
2028

0 commit comments

Comments
 (0)