mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-05 19:41:42 +08:00
[improvement] default props in tsx (#2789)
This commit is contained in:
parent
b9d7143fb3
commit
07a6bcbe9f
@ -8,9 +8,9 @@ import { CreateElement, RenderContext } from 'vue/types';
|
||||
import { DefaultSlots } from '../utils/use/sfc';
|
||||
|
||||
export type ButtonProps = RouteProps & {
|
||||
tag?: string;
|
||||
type?: string;
|
||||
size?: string;
|
||||
tag: string;
|
||||
type: string;
|
||||
size: string;
|
||||
text?: string;
|
||||
block?: boolean;
|
||||
plain?: boolean;
|
||||
|
@ -13,7 +13,7 @@ export type CardProps = {
|
||||
thumb?: string;
|
||||
title?: string;
|
||||
price?: number | string;
|
||||
currency?: string;
|
||||
currency: string;
|
||||
centered?: boolean;
|
||||
lazyLoad?: boolean;
|
||||
thumbLink?: string;
|
||||
|
@ -6,7 +6,7 @@ import { CreateElement, RenderContext } from 'vue/types';
|
||||
import { DefaultSlots } from '../utils/use/sfc';
|
||||
|
||||
export type CellGroupProps = {
|
||||
border?: boolean
|
||||
border: boolean
|
||||
};
|
||||
|
||||
const [sfc, bem] = use('cell-group');
|
||||
|
@ -1,6 +1,6 @@
|
||||
export type SharedCellProps = {
|
||||
icon?: string;
|
||||
border?: boolean;
|
||||
border: boolean;
|
||||
center?: boolean;
|
||||
isLink?: boolean;
|
||||
required?: boolean;
|
||||
|
@ -12,8 +12,8 @@ export type ContactCardProps = {
|
||||
tel?: string;
|
||||
name?: string;
|
||||
type?: string;
|
||||
addText?: string;
|
||||
editable?: boolean;
|
||||
addText: string;
|
||||
editable: boolean;
|
||||
};
|
||||
|
||||
function ContactCard(
|
||||
|
@ -12,7 +12,7 @@ export type IconProps = {
|
||||
size?: string;
|
||||
color?: string;
|
||||
info?: string | number;
|
||||
classPrefix?: string;
|
||||
classPrefix: string;
|
||||
};
|
||||
|
||||
export type IconEvents = {
|
||||
|
@ -7,8 +7,8 @@ import { DefaultSlots } from '../utils/use/sfc';
|
||||
|
||||
export type LoadingProps = {
|
||||
size?: string;
|
||||
type?: string;
|
||||
color?: string;
|
||||
type: string;
|
||||
color: string;
|
||||
};
|
||||
|
||||
const [sfc, bem] = use('loading');
|
||||
|
@ -9,8 +9,8 @@ import { ScopedSlot, DefaultSlots } from '../utils/use/sfc';
|
||||
export type NavBarProps = {
|
||||
title?: string;
|
||||
fixed?: boolean;
|
||||
zIndex?: number;
|
||||
border?: boolean;
|
||||
zIndex: number;
|
||||
border: boolean;
|
||||
leftText?: string;
|
||||
rightText?: string;
|
||||
leftArrow?: boolean;
|
||||
|
@ -9,7 +9,7 @@ import { CreateElement, RenderContext } from 'vue/types';
|
||||
import { DefaultSlots } from '../utils/use/sfc';
|
||||
|
||||
export type SwitchCellProps = SharedSwitchProps & {
|
||||
size?: string;
|
||||
size: string;
|
||||
title?: string;
|
||||
border?: boolean;
|
||||
};
|
||||
|
@ -3,12 +3,12 @@
|
||||
*/
|
||||
|
||||
export type SharedSwitchProps = {
|
||||
size?: string;
|
||||
size: string;
|
||||
value?: any;
|
||||
loading?: boolean;
|
||||
disabled?: boolean;
|
||||
activeValue?: any;
|
||||
inactiveValue?: any;
|
||||
activeValue: any;
|
||||
inactiveValue: any;
|
||||
activeColor?: string;
|
||||
inactiveColor?: string;
|
||||
};
|
||||
|
@ -53,13 +53,13 @@ export type FunctionalComponent<
|
||||
};
|
||||
|
||||
export type TsxBaseProps = {
|
||||
class?: any;
|
||||
style?: any;
|
||||
class: any;
|
||||
style: any;
|
||||
// hack for jsx prop spread
|
||||
props?: any;
|
||||
props: any;
|
||||
};
|
||||
export type TsxComponent<Props, Events> = (
|
||||
props: Props & Events & TsxBaseProps
|
||||
props: Partial<Props & Events & TsxBaseProps>
|
||||
) => VNode;
|
||||
|
||||
const arrayProp = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user