refactor: reorganize all components (#8303)
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
/**
|
||||
* Create a basic component with common options
|
||||
*/
|
||||
import { App, defineComponent, ComponentOptionsWithObjectProps } from 'vue';
|
||||
import { camelize } from '../format/string';
|
||||
|
||||
export function createComponent(name: string) {
|
||||
return function (sfc: ComponentOptionsWithObjectProps) {
|
||||
sfc.name = name;
|
||||
sfc.install = (app: App) => {
|
||||
app.component(name as string, sfc);
|
||||
app.component(camelize(`-${name}`), sfc);
|
||||
};
|
||||
|
||||
return defineComponent(sfc);
|
||||
} as typeof defineComponent;
|
||||
}
|
||||
@@ -1,12 +1,7 @@
|
||||
import { createBEM } from './bem';
|
||||
import { createComponent } from './component';
|
||||
import { createTranslate } from './translate';
|
||||
|
||||
export function createNamespace(name: string) {
|
||||
name = 'van-' + name;
|
||||
return [
|
||||
createComponent(name),
|
||||
createBEM(name),
|
||||
createTranslate(name),
|
||||
] as const;
|
||||
return [name, createBEM(name), createTranslate(name)] as const;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user