mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[improvement] make props less magic (#3775)
This commit is contained in:
parent
642639da6e
commit
be96fa2233
@ -21,7 +21,7 @@ export type ActionSheetItem = {
|
|||||||
|
|
||||||
export type ActionSheetProps = PopupMixinProps & {
|
export type ActionSheetProps = PopupMixinProps & {
|
||||||
title?: string;
|
title?: string;
|
||||||
actions: ActionSheetItem[];
|
actions?: ActionSheetItem[];
|
||||||
duration: number;
|
duration: number;
|
||||||
cancelText?: string;
|
cancelText?: string;
|
||||||
closeOnClickAction?: boolean;
|
closeOnClickAction?: boolean;
|
||||||
@ -126,7 +126,7 @@ function ActionSheet(
|
|||||||
{...inherit(ctx, true)}
|
{...inherit(ctx, true)}
|
||||||
>
|
>
|
||||||
{Header()}
|
{Header()}
|
||||||
{props.actions.map(Option)}
|
{props.actions && props.actions.map(Option)}
|
||||||
{Content()}
|
{Content()}
|
||||||
{CancelText()}
|
{CancelText()}
|
||||||
</Popup>
|
</Popup>
|
||||||
@ -137,14 +137,11 @@ ActionSheet.props = {
|
|||||||
...PopupMixin.props,
|
...PopupMixin.props,
|
||||||
title: String,
|
title: String,
|
||||||
actions: Array,
|
actions: Array,
|
||||||
|
duration: Number,
|
||||||
cancelText: String,
|
cancelText: String,
|
||||||
getContainer: [String, Function],
|
getContainer: [String, Function],
|
||||||
closeOnClickAction: Boolean,
|
closeOnClickAction: Boolean,
|
||||||
safeAreaInsetBottom: Boolean,
|
safeAreaInsetBottom: Boolean,
|
||||||
duration: {
|
|
||||||
type: Number,
|
|
||||||
default: null
|
|
||||||
},
|
|
||||||
overlay: {
|
overlay: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
|
@ -226,11 +226,11 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render(h) {
|
render(h) {
|
||||||
const { data, errorInfo } = this;
|
const { data, errorInfo, searchResult } = this;
|
||||||
const onFocus = name => () => this.onFocus(name);
|
const onFocus = name => () => this.onFocus(name);
|
||||||
|
|
||||||
// hide bottom field when use search && detail get focused
|
// hide bottom field when use search && detail get focused
|
||||||
const hideBottomFields = this.searchResult.length && this.detailFocused;
|
const hideBottomFields = searchResult && searchResult.length && this.detailFocused;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={bem()}>
|
<div class={bem()}>
|
||||||
|
@ -13,8 +13,8 @@ export type AddressListProps = {
|
|||||||
switchable: boolean;
|
switchable: boolean;
|
||||||
disabledText?: string;
|
disabledText?: string;
|
||||||
addButtonText?: string;
|
addButtonText?: string;
|
||||||
list: AddressItemData[];
|
list?: AddressItemData[];
|
||||||
disabledList: AddressItemData[];
|
disabledList?: AddressItemData[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type AddressListSlots = DefaultSlots & {
|
export type AddressListSlots = DefaultSlots & {
|
||||||
@ -29,8 +29,12 @@ function AddressList(
|
|||||||
slots: AddressListSlots,
|
slots: AddressListSlots,
|
||||||
ctx: RenderContext<AddressListProps>
|
ctx: RenderContext<AddressListProps>
|
||||||
) {
|
) {
|
||||||
const getList = (list: AddressItemData[], disabled?: boolean) =>
|
function renderList(list?: AddressItemData[], disabled?: boolean) {
|
||||||
list.map((item, index) => (
|
if (!list) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return list.map((item, index) => (
|
||||||
<AddressItem
|
<AddressItem
|
||||||
data={item}
|
data={item}
|
||||||
key={item.id}
|
key={item.id}
|
||||||
@ -44,9 +48,10 @@ function AddressList(
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
));
|
));
|
||||||
|
}
|
||||||
|
|
||||||
const List = getList(props.list);
|
const List = renderList(props.list);
|
||||||
const DisabledList = getList(props.disabledList, true);
|
const DisabledList = renderList(props.disabledList, true);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={bem()} {...inherit(ctx)}>
|
<div class={bem()} {...inherit(ctx)}>
|
||||||
@ -59,9 +64,7 @@ function AddressList(
|
|||||||
>
|
>
|
||||||
{List}
|
{List}
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
{props.disabledText && (
|
{props.disabledText && <div class={bem('disabled-text')}>{props.disabledText}</div>}
|
||||||
<div class={bem('disabled-text')}>{props.disabledText}</div>
|
|
||||||
)}
|
|
||||||
{DisabledList}
|
{DisabledList}
|
||||||
{slots.default && slots.default()}
|
{slots.default && slots.default()}
|
||||||
<Button
|
<Button
|
||||||
@ -83,7 +86,7 @@ AddressList.props = {
|
|||||||
disabledList: Array,
|
disabledList: Array,
|
||||||
disabledText: String,
|
disabledText: String,
|
||||||
addButtonText: String,
|
addButtonText: String,
|
||||||
value: [String, Number],
|
value: [Number, String],
|
||||||
switchable: {
|
switchable: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
|
@ -13,7 +13,7 @@ export default createComponent({
|
|||||||
default: () => ({})
|
default: () => ({})
|
||||||
},
|
},
|
||||||
columnsNum: {
|
columnsNum: {
|
||||||
type: [String, Number],
|
type: [Number, String],
|
||||||
default: 3
|
default: 3
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -27,9 +27,9 @@ export const cellProps = {
|
|||||||
titleClass: null as any,
|
titleClass: null as any,
|
||||||
valueClass: null as any,
|
valueClass: null as any,
|
||||||
labelClass: null as any,
|
labelClass: null as any,
|
||||||
title: [String, Number],
|
title: [Number, String],
|
||||||
value: [String, Number],
|
value: [Number, String],
|
||||||
label: [String, Number],
|
label: [Number, String],
|
||||||
arrowDirection: String,
|
arrowDirection: String,
|
||||||
border: {
|
border: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
@ -8,8 +8,11 @@ export default createComponent({
|
|||||||
|
|
||||||
props: {
|
props: {
|
||||||
max: Number,
|
max: Number,
|
||||||
value: Array,
|
disabled: Boolean,
|
||||||
disabled: Boolean
|
value: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -13,8 +13,14 @@ function format(rate) {
|
|||||||
export default createComponent({
|
export default createComponent({
|
||||||
props: {
|
props: {
|
||||||
text: String,
|
text: String,
|
||||||
value: Number,
|
value: {
|
||||||
speed: Number,
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
speed: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
size: {
|
size: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '100px'
|
default: '100px'
|
||||||
|
@ -12,7 +12,7 @@ export default createComponent({
|
|||||||
|
|
||||||
props: {
|
props: {
|
||||||
...cellProps,
|
...cellProps,
|
||||||
name: [String, Number],
|
name: [Number, String],
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
isLink: {
|
isLink: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
@ -19,7 +19,7 @@ export type ContactListItem = {
|
|||||||
|
|
||||||
export type ContactListProps = {
|
export type ContactListProps = {
|
||||||
value?: any;
|
value?: any;
|
||||||
list: ContactListItem[];
|
list?: ContactListItem[];
|
||||||
addText?: string;
|
addText?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -31,39 +31,49 @@ function ContactList(
|
|||||||
slots: DefaultSlots,
|
slots: DefaultSlots,
|
||||||
ctx: RenderContext<ContactListProps>
|
ctx: RenderContext<ContactListProps>
|
||||||
) {
|
) {
|
||||||
const List = props.list.map((item, index) => {
|
const List =
|
||||||
const onClick = () => {
|
props.list &&
|
||||||
emit(ctx, 'input', item.id);
|
props.list.map((item, index) => {
|
||||||
emit(ctx, 'select', item, index);
|
function onClick() {
|
||||||
};
|
emit(ctx, 'input', item.id);
|
||||||
|
emit(ctx, 'select', item, index);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
function Content() {
|
||||||
<Cell
|
return (
|
||||||
key={item.id}
|
<Radio name={item.id} iconSize={16} checkedColor={RED} onClick={onClick}>
|
||||||
isLink
|
<div class={bem('name')}>{`${item.name},${item.tel}`}</div>
|
||||||
class={bem('item')}
|
</Radio>
|
||||||
valueClass={bem('item-value')}
|
);
|
||||||
scopedSlots={{
|
}
|
||||||
default: () => (
|
|
||||||
<Radio name={item.id} iconSize={16} checkedColor={RED} onClick={onClick}>
|
function RightIcon() {
|
||||||
<div class={bem('name')}>{`${item.name},${item.tel}`}</div>
|
return (
|
||||||
</Radio>
|
<Icon
|
||||||
),
|
name="edit"
|
||||||
'right-icon': () => (
|
class={bem('edit')}
|
||||||
<Icon
|
onClick={event => {
|
||||||
name="edit"
|
event.stopPropagation();
|
||||||
class={bem('edit')}
|
emit(ctx, 'edit', item, index);
|
||||||
onClick={event => {
|
}}
|
||||||
event.stopPropagation();
|
/>
|
||||||
emit(ctx, 'edit', item, index);
|
);
|
||||||
}}
|
}
|
||||||
/>
|
|
||||||
)
|
return (
|
||||||
}}
|
<Cell
|
||||||
onClick={onClick}
|
key={item.id}
|
||||||
/>
|
isLink
|
||||||
);
|
class={bem('item')}
|
||||||
});
|
valueClass={bem('item-value')}
|
||||||
|
scopedSlots={{
|
||||||
|
default: Content,
|
||||||
|
'right-icon': RightIcon
|
||||||
|
}}
|
||||||
|
onClick={onClick}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={bem()} {...inherit(ctx)}>
|
<div class={bem()} {...inherit(ctx)}>
|
||||||
|
@ -60,7 +60,10 @@ CouponCell.model = {
|
|||||||
|
|
||||||
CouponCell.props = {
|
CouponCell.props = {
|
||||||
title: String,
|
title: String,
|
||||||
coupons: Array,
|
coupons: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
currency: {
|
currency: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '¥'
|
default: '¥'
|
||||||
|
@ -15,8 +15,6 @@ export default createComponent({
|
|||||||
|
|
||||||
props: {
|
props: {
|
||||||
code: String,
|
code: String,
|
||||||
coupons: Array,
|
|
||||||
disabledCoupons: Array,
|
|
||||||
closeButtonText: String,
|
closeButtonText: String,
|
||||||
inputPlaceholder: String,
|
inputPlaceholder: String,
|
||||||
enabledTitle: String,
|
enabledTitle: String,
|
||||||
@ -32,6 +30,14 @@ export default createComponent({
|
|||||||
type: Number,
|
type: Number,
|
||||||
default: -1
|
default: -1
|
||||||
},
|
},
|
||||||
|
coupons: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
|
disabledCoupons: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
displayedCouponIndex: {
|
displayedCouponIndex: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: -1
|
default: -1
|
||||||
|
@ -18,8 +18,14 @@ export default createComponent({
|
|||||||
...pickerProps,
|
...pickerProps,
|
||||||
value: null,
|
value: null,
|
||||||
filter: Function,
|
filter: Function,
|
||||||
minHour: Number,
|
minHour: {
|
||||||
minMinute: Number,
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
minMinute: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'datetime'
|
default: 'datetime'
|
||||||
|
@ -12,9 +12,12 @@ export default createComponent({
|
|||||||
props: {
|
props: {
|
||||||
value: null,
|
value: null,
|
||||||
title: String,
|
title: String,
|
||||||
options: Array,
|
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
titleClass: String
|
titleClass: String,
|
||||||
|
options: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
|
@ -14,15 +14,15 @@ export default createComponent({
|
|||||||
props: {
|
props: {
|
||||||
...cellProps,
|
...cellProps,
|
||||||
error: Boolean,
|
error: Boolean,
|
||||||
|
readonly: Boolean,
|
||||||
|
autosize: [Boolean, Object],
|
||||||
leftIcon: String,
|
leftIcon: String,
|
||||||
rightIcon: String,
|
rightIcon: String,
|
||||||
readonly: Boolean,
|
|
||||||
clearable: Boolean,
|
clearable: Boolean,
|
||||||
labelWidth: [String, Number],
|
|
||||||
labelClass: null,
|
labelClass: null,
|
||||||
|
labelWidth: [Number, String],
|
||||||
labelAlign: String,
|
labelAlign: String,
|
||||||
inputAlign: String,
|
inputAlign: String,
|
||||||
autosize: [Boolean, Object],
|
|
||||||
errorMessage: String,
|
errorMessage: String,
|
||||||
errorMessageAlign: String,
|
errorMessageAlign: String,
|
||||||
type: {
|
type: {
|
||||||
|
@ -58,7 +58,7 @@ GoodsActionIcon.props = {
|
|||||||
...routeProps,
|
...routeProps,
|
||||||
text: String,
|
text: String,
|
||||||
icon: String,
|
icon: String,
|
||||||
info: [String, Number],
|
info: [Number, String],
|
||||||
iconClass: null as any
|
iconClass: null as any
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ export default createComponent({
|
|||||||
mixins: [ParentMixin('vanGrid')],
|
mixins: [ParentMixin('vanGrid')],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
gutter: [Number, String],
|
|
||||||
square: Boolean,
|
square: Boolean,
|
||||||
|
gutter: [Number, String],
|
||||||
clickable: Boolean,
|
clickable: Boolean,
|
||||||
columnNum: {
|
columnNum: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
@ -52,9 +52,9 @@ function Icon(
|
|||||||
|
|
||||||
Icon.props = {
|
Icon.props = {
|
||||||
name: String,
|
name: String,
|
||||||
size: [String, Number],
|
size: [Number, String],
|
||||||
color: String,
|
color: String,
|
||||||
info: [String, Number],
|
info: [Number, String],
|
||||||
tag: {
|
tag: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'i'
|
default: 'i'
|
||||||
|
@ -26,12 +26,14 @@ export default createComponent({
|
|||||||
],
|
],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
images: Array,
|
|
||||||
className: null,
|
className: null,
|
||||||
lazyLoad: Boolean,
|
lazyLoad: Boolean,
|
||||||
asyncClose: Boolean,
|
asyncClose: Boolean,
|
||||||
startPosition: Number,
|
|
||||||
showIndicators: Boolean,
|
showIndicators: Boolean,
|
||||||
|
images: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
loop: {
|
loop: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
@ -44,6 +46,10 @@ export default createComponent({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
|
startPosition: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
minZoom: {
|
minZoom: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 1 / 3
|
default: 1 / 3
|
||||||
@ -54,7 +60,7 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
overlayClass: {
|
overlayClass: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'van-image-preview__overlay'
|
default: bem('overlay')
|
||||||
},
|
},
|
||||||
closeOnClickOverlay: {
|
closeOnClickOverlay: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
@ -9,8 +9,8 @@ export default createComponent({
|
|||||||
fit: String,
|
fit: String,
|
||||||
alt: String,
|
alt: String,
|
||||||
lazyLoad: Boolean,
|
lazyLoad: Boolean,
|
||||||
width: [String, Number],
|
width: [Number, String],
|
||||||
height: [String, Number]
|
height: [Number, String]
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
|
@ -7,7 +7,7 @@ export default createComponent({
|
|||||||
mixins: [ChildrenMixin('vanIndexBar', { indexKey: 'childrenIndex' })],
|
mixins: [ChildrenMixin('vanIndexBar', { indexKey: 'childrenIndex' })],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
index: [String, Number]
|
index: [Number, String]
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
|
@ -29,7 +29,7 @@ function Info(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Info.props = {
|
Info.props = {
|
||||||
info: [String, Number]
|
info: [Number, String]
|
||||||
};
|
};
|
||||||
|
|
||||||
export default createComponent<InfoProps>(Info);
|
export default createComponent<InfoProps>(Info);
|
||||||
|
@ -74,9 +74,9 @@ function Loading(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Loading.props = {
|
Loading.props = {
|
||||||
size: [String, Number],
|
size: [Number, String],
|
||||||
textSize: [String, Number],
|
|
||||||
vertical: Boolean,
|
vertical: Boolean,
|
||||||
|
textSize: [Number, String],
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'circular'
|
default: 'circular'
|
||||||
|
@ -11,8 +11,8 @@ export const CheckboxMixin = ({ parent, bem, role }) => ({
|
|||||||
props: {
|
props: {
|
||||||
name: null,
|
name: null,
|
||||||
value: null,
|
value: null,
|
||||||
iconSize: [String, Number],
|
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
|
iconSize: [Number, String],
|
||||||
checkedColor: String,
|
checkedColor: String,
|
||||||
labelPosition: String,
|
labelPosition: String,
|
||||||
labelDisabled: Boolean,
|
labelDisabled: Boolean,
|
||||||
|
@ -29,7 +29,7 @@ export const PopupMixin = {
|
|||||||
// whether to close popup when click overlay
|
// whether to close popup when click overlay
|
||||||
closeOnClickOverlay: Boolean,
|
closeOnClickOverlay: Boolean,
|
||||||
// z-index
|
// z-index
|
||||||
zIndex: [String, Number],
|
zIndex: [Number, String],
|
||||||
// prevent body scroll
|
// prevent body scroll
|
||||||
lockScroll: {
|
lockScroll: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
@ -12,7 +12,7 @@ export default createComponent({
|
|||||||
wrapable: Boolean,
|
wrapable: Boolean,
|
||||||
background: String,
|
background: String,
|
||||||
delay: {
|
delay: {
|
||||||
type: [String, Number],
|
type: [Number, String],
|
||||||
default: 1
|
default: 1
|
||||||
},
|
},
|
||||||
scrollable: {
|
scrollable: {
|
||||||
|
@ -48,7 +48,7 @@ function Notify(
|
|||||||
Notify.props = {
|
Notify.props = {
|
||||||
...PopupMixin.props,
|
...PopupMixin.props,
|
||||||
className: null as any,
|
className: null as any,
|
||||||
message: [String, Number],
|
message: [Number, String],
|
||||||
getContainer: [String, Function],
|
getContainer: [String, Function],
|
||||||
color: {
|
color: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -5,8 +5,11 @@ const [createComponent, bem] = createNamespace('key');
|
|||||||
export default createComponent({
|
export default createComponent({
|
||||||
props: {
|
props: {
|
||||||
type: String,
|
type: String,
|
||||||
theme: Array,
|
text: [Number, String],
|
||||||
text: [String, Number]
|
theme: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
|
@ -54,16 +54,13 @@ function Overlay(
|
|||||||
|
|
||||||
Overlay.props = {
|
Overlay.props = {
|
||||||
show: Boolean,
|
show: Boolean,
|
||||||
|
duration: [Number, String],
|
||||||
className: null as any,
|
className: null as any,
|
||||||
customStyle: null as any,
|
customStyle: null as any,
|
||||||
zIndex: {
|
zIndex: {
|
||||||
type: [Number, String],
|
type: [Number, String],
|
||||||
default: 1
|
default: 1
|
||||||
},
|
},
|
||||||
duration: {
|
|
||||||
type: [Number, String],
|
|
||||||
default: null
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default createComponent<OverlayProps, OverlayEvents>(Overlay);
|
export default createComponent<OverlayProps, OverlayEvents>(Overlay);
|
||||||
|
@ -8,12 +8,21 @@ function makePage(number, text, active) {
|
|||||||
|
|
||||||
export default createComponent({
|
export default createComponent({
|
||||||
props: {
|
props: {
|
||||||
value: Number,
|
|
||||||
prevText: String,
|
prevText: String,
|
||||||
nextText: String,
|
nextText: String,
|
||||||
pageCount: Number,
|
|
||||||
totalItems: Number,
|
|
||||||
forceEllipses: Boolean,
|
forceEllipses: Boolean,
|
||||||
|
value: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
pageCount: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
totalItems: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
mode: {
|
mode: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'multi'
|
default: 'multi'
|
||||||
|
@ -60,8 +60,8 @@ function PasswordInput(
|
|||||||
|
|
||||||
PasswordInput.props = {
|
PasswordInput.props = {
|
||||||
info: String,
|
info: String,
|
||||||
|
gutter: [Number, String],
|
||||||
errorInfo: String,
|
errorInfo: String,
|
||||||
gutter: [String, Number],
|
|
||||||
mask: {
|
mask: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
|
@ -35,8 +35,11 @@ export default createComponent({
|
|||||||
className: String,
|
className: String,
|
||||||
itemHeight: Number,
|
itemHeight: Number,
|
||||||
defaultIndex: Number,
|
defaultIndex: Number,
|
||||||
initialOptions: Array,
|
visibleItemCount: Number,
|
||||||
visibleItemCount: Number
|
initialOptions: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
|
@ -11,8 +11,14 @@ const [createComponent, bem, t] = createNamespace('picker');
|
|||||||
export default createComponent({
|
export default createComponent({
|
||||||
props: {
|
props: {
|
||||||
...pickerProps,
|
...pickerProps,
|
||||||
columns: Array,
|
defaultIndex: {
|
||||||
defaultIndex: Number,
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
columns: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
toolbarPosition: {
|
toolbarPosition: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'top'
|
default: 'top'
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
exports[`column watch default index 1`] = `
|
exports[`column watch default index 1`] = `
|
||||||
<div class="van-picker-column">
|
<div class="van-picker-column">
|
||||||
<ul class="van-picker-column__wrapper" style="transform: translate3d(0, -75px, 0); transition-duration: 0ms; transition-property: none; line-height: 50px;">
|
<ul class="van-picker-column__wrapper" style="transform: translate3d(0, 100px, 0); transition-duration: 0ms; transition-property: none; line-height: 50px;">
|
||||||
<li class="van-ellipsis van-picker-column__item van-picker-column__item--disabled" style="height: 50px;">1</li>
|
<li class="van-ellipsis van-picker-column__item van-picker-column__item--disabled" style="height: 50px;">1</li>
|
||||||
<li class="van-ellipsis van-picker-column__item" style="height: 50px;">1990</li>
|
<li class="van-ellipsis van-picker-column__item" style="height: 50px;">1990</li>
|
||||||
<li class="van-ellipsis van-picker-column__item" style="height: 50px;">1991</li>
|
<li class="van-ellipsis van-picker-column__item" style="height: 50px;">1991</li>
|
||||||
@ -16,7 +16,7 @@ exports[`column watch default index 1`] = `
|
|||||||
|
|
||||||
exports[`column watch default index 2`] = `
|
exports[`column watch default index 2`] = `
|
||||||
<div class="van-picker-column">
|
<div class="van-picker-column">
|
||||||
<ul class="van-picker-column__wrapper" style="transform: translate3d(0, -125px, 0); transition-duration: 0ms; transition-property: none; line-height: 50px;">
|
<ul class="van-picker-column__wrapper" style="transform: translate3d(0, 0px, 0); transition-duration: 0ms; transition-property: none; line-height: 50px;">
|
||||||
<li class="van-ellipsis van-picker-column__item van-picker-column__item--disabled" style="height: 50px;">1</li>
|
<li class="van-ellipsis van-picker-column__item van-picker-column__item--disabled" style="height: 50px;">1</li>
|
||||||
<li class="van-ellipsis van-picker-column__item" style="height: 50px;">1990</li>
|
<li class="van-ellipsis van-picker-column__item" style="height: 50px;">1990</li>
|
||||||
<li class="van-ellipsis van-picker-column__item" style="height: 50px;">1991</li>
|
<li class="van-ellipsis van-picker-column__item" style="height: 50px;">1991</li>
|
||||||
|
@ -114,7 +114,8 @@ test('column watch default index', async () => {
|
|||||||
propsData: {
|
propsData: {
|
||||||
initialOptions: [disabled, ...simpleColumn],
|
initialOptions: [disabled, ...simpleColumn],
|
||||||
valueKey: 'text',
|
valueKey: 'text',
|
||||||
itemHeight: 50
|
itemHeight: 50,
|
||||||
|
visibleItemCount: 5
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -7,11 +7,8 @@ export default createComponent({
|
|||||||
mixins: [PopupMixin],
|
mixins: [PopupMixin],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
duration: Number,
|
||||||
transition: String,
|
transition: String,
|
||||||
duration: {
|
|
||||||
type: Number,
|
|
||||||
default: null
|
|
||||||
},
|
|
||||||
position: {
|
position: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'center'
|
default: 'center'
|
||||||
|
@ -154,12 +154,15 @@ function Rate(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Rate.props = {
|
Rate.props = {
|
||||||
value: Number,
|
size: [Number, String],
|
||||||
size: [String, Number],
|
gutter: [Number, String],
|
||||||
gutter: [String, Number],
|
|
||||||
readonly: Boolean,
|
readonly: Boolean,
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
allowHalf: Boolean,
|
allowHalf: Boolean,
|
||||||
|
value: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
icon: {
|
icon: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'star'
|
default: 'star'
|
||||||
|
@ -10,7 +10,7 @@ export default createComponent({
|
|||||||
|
|
||||||
props: {
|
props: {
|
||||||
...routeProps,
|
...routeProps,
|
||||||
info: [String, Number],
|
info: [Number, String],
|
||||||
title: String
|
title: String
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -84,9 +84,12 @@ function Skeleton(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Skeleton.props = {
|
Skeleton.props = {
|
||||||
row: Number,
|
|
||||||
title: Boolean,
|
title: Boolean,
|
||||||
avatar: Boolean,
|
avatar: Boolean,
|
||||||
|
row: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
loading: {
|
loading: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
|
@ -20,21 +20,27 @@ export default createComponent({
|
|||||||
props: {
|
props: {
|
||||||
sku: Object,
|
sku: Object,
|
||||||
goods: Object,
|
goods: Object,
|
||||||
quota: Number,
|
|
||||||
value: Boolean,
|
value: Boolean,
|
||||||
buyText: String,
|
buyText: String,
|
||||||
addCartText: String,
|
|
||||||
quotaUsed: Number,
|
|
||||||
goodsId: [Number, String],
|
goodsId: [Number, String],
|
||||||
hideStock: Boolean,
|
hideStock: Boolean,
|
||||||
hideQuotaText: Boolean,
|
addCartText: String,
|
||||||
stepperTitle: String,
|
stepperTitle: String,
|
||||||
getContainer: Function,
|
getContainer: Function,
|
||||||
|
hideQuotaText: Boolean,
|
||||||
|
resetStepperOnHide: Boolean,
|
||||||
customSkuValidator: Function,
|
customSkuValidator: Function,
|
||||||
closeOnClickOverlay: Boolean,
|
closeOnClickOverlay: Boolean,
|
||||||
disableStepperInput: Boolean,
|
disableStepperInput: Boolean,
|
||||||
resetStepperOnHide: Boolean,
|
|
||||||
resetSelectedSkuOnHide: Boolean,
|
resetSelectedSkuOnHide: Boolean,
|
||||||
|
quota: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
quotaUsed: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
initialSku: {
|
initialSku: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({})
|
default: () => ({})
|
||||||
|
@ -5,11 +5,14 @@ const [createComponent] = createNamespace('sku-row-item');
|
|||||||
|
|
||||||
export default createComponent({
|
export default createComponent({
|
||||||
props: {
|
props: {
|
||||||
skuList: Array,
|
|
||||||
skuValue: Object,
|
skuValue: Object,
|
||||||
skuKeyStr: String,
|
skuKeyStr: String,
|
||||||
skuEventBus: Object,
|
skuEventBus: Object,
|
||||||
selectedSku: Object
|
selectedSku: Object,
|
||||||
|
skuList: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -7,18 +7,24 @@ const { QUOTA_LIMIT, STOCK_LIMIT } = LIMIT_TYPE;
|
|||||||
|
|
||||||
export default createComponent({
|
export default createComponent({
|
||||||
props: {
|
props: {
|
||||||
quota: Number,
|
|
||||||
quotaUsed: Number,
|
|
||||||
hideStock: Boolean,
|
hideStock: Boolean,
|
||||||
|
selectedSku: Object,
|
||||||
skuEventBus: Object,
|
skuEventBus: Object,
|
||||||
skuStockNum: Number,
|
skuStockNum: Number,
|
||||||
selectedSku: Object,
|
|
||||||
selectedNum: Number,
|
selectedNum: Number,
|
||||||
stepperTitle: String,
|
stepperTitle: String,
|
||||||
hideQuotaText: Boolean,
|
hideQuotaText: Boolean,
|
||||||
selectedSkuComb: Object,
|
selectedSkuComb: Object,
|
||||||
disableStepperInput: Boolean,
|
disableStepperInput: Boolean,
|
||||||
customStepperConfig: Object
|
customStepperConfig: Object,
|
||||||
|
quota: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
quotaUsed: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
|
@ -8,12 +8,14 @@ export default createComponent({
|
|||||||
mixins: [TouchMixin],
|
mixins: [TouchMixin],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
min: Number,
|
|
||||||
value: Number,
|
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
vertical: Boolean,
|
vertical: Boolean,
|
||||||
activeColor: String,
|
activeColor: String,
|
||||||
inactiveColor: String,
|
inactiveColor: String,
|
||||||
|
min: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
max: {
|
max: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 100
|
default: 100
|
||||||
@ -22,6 +24,10 @@ export default createComponent({
|
|||||||
type: Number,
|
type: Number,
|
||||||
default: 1
|
default: 1
|
||||||
},
|
},
|
||||||
|
value: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
barHeight: {
|
barHeight: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '2px'
|
default: '2px'
|
||||||
|
@ -10,24 +10,24 @@ export default createComponent({
|
|||||||
value: null,
|
value: null,
|
||||||
integer: Boolean,
|
integer: Boolean,
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
inputWidth: [String, Number],
|
inputWidth: [Number, String],
|
||||||
buttonSize: [String, Number],
|
buttonSize: [Number, String],
|
||||||
asyncChange: Boolean,
|
asyncChange: Boolean,
|
||||||
disableInput: Boolean,
|
disableInput: Boolean,
|
||||||
min: {
|
min: {
|
||||||
type: [String, Number],
|
type: [Number, String],
|
||||||
default: 1
|
default: 1
|
||||||
},
|
},
|
||||||
max: {
|
max: {
|
||||||
type: [String, Number],
|
type: [Number, String],
|
||||||
default: Infinity
|
default: Infinity
|
||||||
},
|
},
|
||||||
step: {
|
step: {
|
||||||
type: [String, Number],
|
type: [Number, String],
|
||||||
default: 1
|
default: 1
|
||||||
},
|
},
|
||||||
defaultValue: {
|
defaultValue: {
|
||||||
type: [String, Number],
|
type: [Number, String],
|
||||||
default: 1
|
default: 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -5,8 +5,11 @@ const [createComponent, bem] = createNamespace('steps');
|
|||||||
|
|
||||||
export default createComponent({
|
export default createComponent({
|
||||||
props: {
|
props: {
|
||||||
active: Number,
|
|
||||||
inactiveIcon: String,
|
inactiveIcon: String,
|
||||||
|
active: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
direction: {
|
direction: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'horizontal'
|
default: 'horizontal'
|
||||||
|
@ -94,17 +94,14 @@ function SubmitBar(
|
|||||||
|
|
||||||
SubmitBar.props = {
|
SubmitBar.props = {
|
||||||
tip: String,
|
tip: String,
|
||||||
tipIcon: String,
|
|
||||||
label: String,
|
label: String,
|
||||||
|
price: Number,
|
||||||
|
tipIcon: String,
|
||||||
loading: Boolean,
|
loading: Boolean,
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
buttonText: String,
|
buttonText: String,
|
||||||
suffixLabel: String,
|
suffixLabel: String,
|
||||||
safeAreaInsetBottom: Boolean,
|
safeAreaInsetBottom: Boolean,
|
||||||
price: {
|
|
||||||
type: Number,
|
|
||||||
default: null
|
|
||||||
},
|
|
||||||
decimalLength: {
|
decimalLength: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 2
|
default: 2
|
||||||
|
@ -22,7 +22,7 @@ export default createComponent({
|
|||||||
leftWidth: Number,
|
leftWidth: Number,
|
||||||
rightWidth: Number,
|
rightWidth: Number,
|
||||||
name: {
|
name: {
|
||||||
type: [String, Number],
|
type: [Number, String],
|
||||||
default: ''
|
default: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -25,23 +25,26 @@ export default createComponent({
|
|||||||
height: Number,
|
height: Number,
|
||||||
autoplay: Number,
|
autoplay: Number,
|
||||||
vertical: Boolean,
|
vertical: Boolean,
|
||||||
initialSwipe: Number,
|
|
||||||
indicatorColor: String,
|
indicatorColor: String,
|
||||||
loop: {
|
loop: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
touchable: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
},
|
|
||||||
showIndicators: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
},
|
|
||||||
duration: {
|
duration: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 500
|
default: 500
|
||||||
|
},
|
||||||
|
touchable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
initialSwipe: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
showIndicators: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ export default createComponent({
|
|||||||
mixins: [ChildrenMixin('vanTabs')],
|
mixins: [ChildrenMixin('vanTabs')],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
name: [String, Number],
|
name: [Number, String],
|
||||||
title: String,
|
title: String,
|
||||||
disabled: Boolean
|
disabled: Boolean
|
||||||
},
|
},
|
||||||
|
@ -11,10 +11,10 @@ export default createComponent({
|
|||||||
|
|
||||||
props: {
|
props: {
|
||||||
...routeProps,
|
...routeProps,
|
||||||
icon: String,
|
|
||||||
dot: Boolean,
|
dot: Boolean,
|
||||||
name: [String, Number],
|
icon: String,
|
||||||
info: [String, Number]
|
name: [Number, String],
|
||||||
|
info: [Number, String]
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
|
@ -12,7 +12,7 @@ export default createComponent({
|
|||||||
inactiveColor: String,
|
inactiveColor: String,
|
||||||
safeAreaInsetBottom: Boolean,
|
safeAreaInsetBottom: Boolean,
|
||||||
value: {
|
value: {
|
||||||
type: [String, Number],
|
type: [Number, String],
|
||||||
default: 0
|
default: 0
|
||||||
},
|
},
|
||||||
border: {
|
border: {
|
||||||
|
@ -31,13 +31,20 @@ export default createComponent({
|
|||||||
color: String,
|
color: String,
|
||||||
sticky: Boolean,
|
sticky: Boolean,
|
||||||
animated: Boolean,
|
animated: Boolean,
|
||||||
offsetTop: Number,
|
|
||||||
swipeable: Boolean,
|
swipeable: Boolean,
|
||||||
background: String,
|
background: String,
|
||||||
lineWidth: [Number, String],
|
lineWidth: [Number, String],
|
||||||
lineHeight: [Number, String],
|
lineHeight: [Number, String],
|
||||||
titleActiveColor: String,
|
titleActiveColor: String,
|
||||||
titleInactiveColor: String,
|
titleInactiveColor: String,
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
default: 'line'
|
||||||
|
},
|
||||||
|
active: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
border: {
|
border: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
@ -46,22 +53,18 @@ export default createComponent({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
lazyRender: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
},
|
|
||||||
active: {
|
|
||||||
type: [Number, String],
|
|
||||||
default: 0
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
type: String,
|
|
||||||
default: 'line'
|
|
||||||
},
|
|
||||||
duration: {
|
duration: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0.3
|
default: 0.3
|
||||||
},
|
},
|
||||||
|
offsetTop: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
lazyRender: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
swipeThreshold: {
|
swipeThreshold: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 4
|
default: 4
|
||||||
|
@ -13,7 +13,7 @@ export default createComponent({
|
|||||||
className: null,
|
className: null,
|
||||||
loadingType: String,
|
loadingType: String,
|
||||||
forbidClick: Boolean,
|
forbidClick: Boolean,
|
||||||
message: [String, Number],
|
message: [Number, String],
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'text'
|
default: 'text'
|
||||||
|
@ -35,7 +35,7 @@ function TreeSelect(
|
|||||||
) {
|
) {
|
||||||
const { height, items, mainActiveIndex, activeId } = props;
|
const { height, items, mainActiveIndex, activeId } = props;
|
||||||
|
|
||||||
const selectedItem = items[mainActiveIndex] || {};
|
const selectedItem: Partial<TreeSelectItem> = items[mainActiveIndex] || {};
|
||||||
const subItems = selectedItem.children || [];
|
const subItems = selectedItem.children || [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -90,15 +90,21 @@ function TreeSelect(
|
|||||||
}
|
}
|
||||||
|
|
||||||
TreeSelect.props = {
|
TreeSelect.props = {
|
||||||
items: Array,
|
items: {
|
||||||
mainActiveIndex: Number,
|
type: Array,
|
||||||
activeId: {
|
default: () => []
|
||||||
type: [Number, String],
|
|
||||||
default: 0
|
|
||||||
},
|
},
|
||||||
height: {
|
height: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 300
|
default: 300
|
||||||
|
},
|
||||||
|
activeId: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
mainActiveIndex: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -18,27 +18,22 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
fileList: Array,
|
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
uploadText: String,
|
uploadText: String,
|
||||||
afterRead: Function,
|
afterRead: Function,
|
||||||
beforeRead: Function,
|
beforeRead: Function,
|
||||||
previewSize: [Number, String],
|
previewSize: [Number, String],
|
||||||
name: {
|
name: {
|
||||||
type: [String, Number],
|
type: [Number, String],
|
||||||
default: ''
|
default: ''
|
||||||
},
|
},
|
||||||
previewImage: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
},
|
|
||||||
accept: {
|
accept: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'image/*'
|
default: 'image/*'
|
||||||
},
|
},
|
||||||
resultType: {
|
fileList: {
|
||||||
type: String,
|
type: Array,
|
||||||
default: 'dataUrl'
|
default: () => []
|
||||||
},
|
},
|
||||||
maxSize: {
|
maxSize: {
|
||||||
type: Number,
|
type: Number,
|
||||||
@ -47,6 +42,14 @@ export default createComponent({
|
|||||||
maxCount: {
|
maxCount: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: Number.MAX_VALUE
|
default: Number.MAX_VALUE
|
||||||
|
},
|
||||||
|
previewImage: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
resultType: {
|
||||||
|
type: String,
|
||||||
|
default: 'dataUrl'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -25,26 +25,6 @@ export type TsxComponent<Props, Events, Slots> = (
|
|||||||
props: Partial<Props & Events & TsxBaseProps<Slots>>
|
props: Partial<Props & Events & TsxBaseProps<Slots>>
|
||||||
) => VNode;
|
) => VNode;
|
||||||
|
|
||||||
const arrayProp = {
|
|
||||||
type: Array,
|
|
||||||
default: () => []
|
|
||||||
};
|
|
||||||
|
|
||||||
const numberProp = {
|
|
||||||
type: Number,
|
|
||||||
default: 0
|
|
||||||
};
|
|
||||||
|
|
||||||
function defaultProps(props: any) {
|
|
||||||
Object.keys(props).forEach(key => {
|
|
||||||
if (props[key] === Array) {
|
|
||||||
props[key] = arrayProp;
|
|
||||||
} else if (props[key] === Number) {
|
|
||||||
props[key] = numberProp;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function install(this: ComponentOptions<Vue>, Vue: VueConstructor) {
|
function install(this: ComponentOptions<Vue>, Vue: VueConstructor) {
|
||||||
const { name } = this;
|
const { name } = this;
|
||||||
Vue.component(name as string, this);
|
Vue.component(name as string, this);
|
||||||
@ -89,10 +69,6 @@ export function createComponent(name: string) {
|
|||||||
sfc.mixins.push(SlotsMixin);
|
sfc.mixins.push(SlotsMixin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sfc.props) {
|
|
||||||
defaultProps(sfc.props);
|
|
||||||
}
|
|
||||||
|
|
||||||
sfc.name = name;
|
sfc.name = name;
|
||||||
sfc.install = install;
|
sfc.install = install;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user