mirror of
https://github.com/youzan/vant.git
synced 2025-10-22 20:04:09 +00:00
[improvement] Info: tsx (#2768)
This commit is contained in:
@@ -13,7 +13,7 @@ type Mods = Mod | Mod[];
|
||||
const ELEMENT = '__';
|
||||
const MODS = '--';
|
||||
|
||||
function join(name: string, el: string, symbol: string): string {
|
||||
function join(name: string, el?: string, symbol?: string): string {
|
||||
return el ? name + symbol + el : name;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ function prefix(name: string, mods: Mods): Mods {
|
||||
return ret;
|
||||
}
|
||||
|
||||
export default (name: string) => (el: Mods, mods?: Mods): Mods => {
|
||||
export default (name: string) => (el?: Mods, mods?: Mods): Mods => {
|
||||
if (el && typeof el !== 'string') {
|
||||
mods = el;
|
||||
el = '';
|
||||
|
@@ -15,7 +15,17 @@ import { InjectOptions, PropsDefinition } from 'vue/types/options';
|
||||
|
||||
export type ScopedSlot = (props?: any) => VNode[] | undefined;
|
||||
|
||||
export type VantComponentOptions = ComponentOptions<Vue> & {
|
||||
export type ScopedSlots = {
|
||||
[key: string]: ScopedSlot | undefined;
|
||||
default?: ScopedSlot;
|
||||
};
|
||||
|
||||
export type ModelOptions = {
|
||||
prop?: string;
|
||||
event?: string;
|
||||
};
|
||||
|
||||
export interface VantComponentOptions extends ComponentOptions<Vue> {
|
||||
functional?: boolean;
|
||||
install?: (Vue: VueConstructor) => void;
|
||||
};
|
||||
@@ -29,17 +39,11 @@ export type FunctionalComponent<
|
||||
(
|
||||
h: CreateElement,
|
||||
props: Props,
|
||||
slots: {
|
||||
[key: string]: ScopedSlot | undefined
|
||||
default: ScopedSlot | undefined
|
||||
},
|
||||
slots: ScopedSlots,
|
||||
context: RenderContext<Props>
|
||||
): VNode;
|
||||
): VNode | undefined;
|
||||
props?: PropDefs;
|
||||
model?: {
|
||||
prop?: string;
|
||||
event?: string;
|
||||
};
|
||||
model?: ModelOptions;
|
||||
inject?: InjectOptions;
|
||||
};
|
||||
|
||||
@@ -94,7 +98,7 @@ function transformFunctionalComponent(
|
||||
functional: true,
|
||||
props: pure.props,
|
||||
model: pure.model,
|
||||
render: (h, context) => pure(h, context.props, unifySlots(context), context)
|
||||
render: (h, context): any => pure(h, context.props, unifySlots(context), context)
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user