mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 01:54:48 +00:00
[improvement] Cell: tsx (#2771)
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
* b(['disabled', 'primary']) // 'button button--disabled button--primary'
|
||||
*/
|
||||
|
||||
type Mod = string | { [key: string]: any };
|
||||
type Mods = Mod | Mod[];
|
||||
export type Mod = string | { [key: string]: any };
|
||||
export type Mods = Mod | Mod[];
|
||||
|
||||
const ELEMENT = '__';
|
||||
const MODS = '--';
|
||||
|
@@ -47,7 +47,11 @@ export type FunctionalComponent<
|
||||
inject?: InjectOptions;
|
||||
};
|
||||
|
||||
export type VantTsxComponent<T> = (props: T) => VNode;
|
||||
export type TsxBaseProps = {
|
||||
class?: any;
|
||||
style?: any;
|
||||
}
|
||||
export type TsxComponent<T> = (props: T & TsxBaseProps) => VNode;
|
||||
|
||||
const arrayProp = {
|
||||
type: Array,
|
||||
@@ -104,7 +108,7 @@ function transformFunctionalComponent(
|
||||
|
||||
export default (name: string) => <T = DefaultProps>(
|
||||
sfc: VantComponentOptions | FunctionalComponent
|
||||
): VantTsxComponent<T> => {
|
||||
): TsxComponent<T> => {
|
||||
if (typeof sfc === 'function') {
|
||||
sfc = transformFunctionalComponent(sfc);
|
||||
}
|
||||
@@ -121,5 +125,5 @@ export default (name: string) => <T = DefaultProps>(
|
||||
sfc.name = name;
|
||||
sfc.install = install;
|
||||
|
||||
return sfc as VantTsxComponent<T>;
|
||||
return sfc as TsxComponent<T>;
|
||||
};
|
||||
|
Reference in New Issue
Block a user