perf: add numericProp helper (#9602)

This commit is contained in:
neverland 2021-09-30 16:33:50 +08:00 committed by GitHub
parent 0b71523604
commit d111df8dfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
74 changed files with 351 additions and 418 deletions

View File

@ -1,5 +1,5 @@
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import { extend, createNamespace, unknownProp } from '../utils'; import { extend, createNamespace, unknownProp, numericProp } from '../utils';
import { ACTION_BAR_KEY } from '../action-bar/ActionBar'; import { ACTION_BAR_KEY } from '../action-bar/ActionBar';
// Composables // Composables
@ -20,7 +20,7 @@ export default defineComponent({
text: String, text: String,
icon: String, icon: String,
color: String, color: String,
badge: [Number, String], badge: numericProp,
iconClass: unknownProp, iconClass: unknownProp,
iconPrefix: String, iconPrefix: String,
}), }),

View File

@ -15,6 +15,8 @@ import {
isObject, isObject,
isMobile, isMobile,
truthProp, truthProp,
numericProp,
makeNumericProp,
createNamespace, createNamespace,
} from '../utils'; } from '../utils';
@ -65,20 +67,14 @@ const props = {
showPostal: Boolean, showPostal: Boolean,
disableArea: Boolean, disableArea: Boolean,
searchResult: Array as PropType<AddressEditSearchItem[]>, searchResult: Array as PropType<AddressEditSearchItem[]>,
telMaxlength: [Number, String], telMaxlength: numericProp,
showSetDefault: Boolean, showSetDefault: Boolean,
saveButtonText: String, saveButtonText: String,
areaPlaceholder: String, areaPlaceholder: String,
deleteButtonText: String, deleteButtonText: String,
showSearchResult: Boolean, showSearchResult: Boolean,
detailRows: { detailRows: makeNumericProp(1),
type: [Number, String], detailMaxlength: makeNumericProp(200),
default: 1,
},
detailMaxlength: {
type: [Number, String],
default: 200,
},
addressInfo: { addressInfo: {
type: Object as PropType<Partial<AddressEditInfo>>, type: Object as PropType<Partial<AddressEditInfo>>,
default: () => extend({}, DEFAULT_DATA), default: () => extend({}, DEFAULT_DATA),

View File

@ -1,7 +1,7 @@
import { PropType, ref, defineComponent } from 'vue'; import { PropType, ref, defineComponent } from 'vue';
// Utils // Utils
import { createNamespace } from '../utils'; import { createNamespace, numericProp } from '../utils';
// Components // Components
import { Cell } from '../cell'; import { Cell } from '../cell';
@ -20,10 +20,10 @@ export default defineComponent({
show: Boolean, show: Boolean,
value: String, value: String,
focused: Boolean, focused: Boolean,
detailRows: [Number, String], detailRows: numericProp,
searchResult: Array as PropType<AddressEditSearchItem[]>, searchResult: Array as PropType<AddressEditSearchItem[]>,
errorMessage: String, errorMessage: String,
detailMaxlength: [Number, String], detailMaxlength: numericProp,
showSearchResult: Boolean, showSearchResult: Boolean,
}, },

View File

@ -1,7 +1,7 @@
import { PropType, defineComponent } from 'vue'; import { PropType, defineComponent } from 'vue';
// Utils // Utils
import { truthProp, createNamespace } from '../utils'; import { truthProp, numericProp, createNamespace } from '../utils';
// Components // Components
import { Button } from '../button'; import { Button } from '../button';
@ -14,7 +14,7 @@ export default defineComponent({
name, name,
props: { props: {
modelValue: [Number, String], modelValue: numericProp,
switchable: truthProp, switchable: truthProp,
disabledText: String, disabledText: String,
addButtonText: String, addButtonText: String,

View File

@ -12,7 +12,7 @@ import {
// Utils // Utils
import { deepClone } from '../utils/deep-clone'; import { deepClone } from '../utils/deep-clone';
import { pick, createNamespace, extend } from '../utils'; import { pick, createNamespace, extend, makeNumericProp } from '../utils';
import { pickerProps } from '../picker/Picker'; import { pickerProps } from '../picker/Picker';
// Composables // Composables
@ -50,14 +50,11 @@ const isOverseaCode = (code: string) => code[0] === '9';
const props = extend({}, pickerProps, { const props = extend({}, pickerProps, {
value: String, value: String,
columnsNum: makeNumericProp(3),
areaList: { areaList: {
type: Object as PropType<AreaList>, type: Object as PropType<AreaList>,
default: () => ({}), default: () => ({}),
}, },
columnsNum: {
type: [Number, String],
default: 3,
},
isOverseaCode: { isOverseaCode: {
type: Function as PropType<(code: string) => boolean>, type: Function as PropType<(code: string) => boolean>,
default: isOverseaCode, default: isOverseaCode,

View File

@ -4,6 +4,7 @@ import {
addUnit, addUnit,
isNumeric, isNumeric,
truthProp, truthProp,
numericProp,
createNamespace, createNamespace,
} from '../utils'; } from '../utils';
@ -14,10 +15,10 @@ export default defineComponent({
props: { props: {
dot: Boolean, dot: Boolean,
max: [Number, String], max: numericProp,
color: String, color: String,
offset: Array as unknown as PropType<[string | number, string | number]>, offset: Array as unknown as PropType<[string | number, string | number]>,
content: [Number, String], content: numericProp,
showZero: truthProp, showZero: truthProp,
tag: { tag: {
type: String as PropType<keyof HTMLElementTagNameMap>, type: String as PropType<keyof HTMLElementTagNameMap>,

View File

@ -6,7 +6,12 @@ import {
} from 'vue'; } from 'vue';
// Utils // Utils
import { createNamespace, BORDER_SURROUND, extend } from '../utils'; import {
extend,
numericProp,
createNamespace,
BORDER_SURROUND,
} from '../utils';
import { useRoute, routeProps } from '../composables/use-route'; import { useRoute, routeProps } from '../composables/use-route';
// Components // Components
@ -39,7 +44,7 @@ export default defineComponent({
hairline: Boolean, hairline: Boolean,
disabled: Boolean, disabled: Boolean,
iconPrefix: String, iconPrefix: String,
loadingSize: [Number, String], loadingSize: numericProp,
loadingText: String, loadingText: String,
loadingType: String as PropType<LoadingType>, loadingType: String as PropType<LoadingType>,
tag: { tag: {

View File

@ -9,7 +9,14 @@ import {
} from 'vue'; } from 'vue';
// Utils // Utils
import { pick, isDate, truthProp, getScrollTop } from '../utils'; import {
pick,
isDate,
truthProp,
numericProp,
getScrollTop,
makeNumericProp,
} from '../utils';
import { import {
t, t,
bem, bem,
@ -56,7 +63,7 @@ const props = {
showMark: truthProp, showMark: truthProp,
showTitle: truthProp, showTitle: truthProp,
formatter: Function as PropType<(item: CalendarDayItem) => CalendarDayItem>, formatter: Function as PropType<(item: CalendarDayItem) => CalendarDayItem>,
rowHeight: [Number, String], rowHeight: numericProp,
confirmText: String, confirmText: String,
rangePrompt: String, rangePrompt: String,
lazyRender: truthProp, lazyRender: truthProp,
@ -76,10 +83,7 @@ const props = {
type: String as PropType<PopupPosition>, type: String as PropType<PopupPosition>,
default: 'bottom', default: 'bottom',
}, },
maxRange: { maxRange: makeNumericProp(null),
type: [Number, String],
default: null,
},
minDate: { minDate: {
type: Date, type: Date,
validator: isDate, validator: isDate,
@ -94,7 +98,7 @@ const props = {
}, },
}, },
firstDayOfWeek: { firstDayOfWeek: {
type: [Number, String], type: numericProp,
default: 0, default: 0,
validator: (val: number) => val >= 0 && val <= 6, validator: (val: number) => val >= 0 && val <= 6,
}, },

View File

@ -7,7 +7,13 @@ import {
} from 'vue'; } from 'vue';
// Utils // Utils
import { addUnit, setScrollTop, createNamespace, pick } from '../utils'; import {
pick,
addUnit,
numericProp,
setScrollTop,
createNamespace,
} from '../utils';
import { getMonthEndDay } from '../datetime-picker/utils'; import { getMonthEndDay } from '../datetime-picker/utils';
import { import {
t, t,
@ -35,7 +41,7 @@ const props = {
type: String as PropType<CalendarType>, type: String as PropType<CalendarType>,
color: String, color: String,
showMark: Boolean, showMark: Boolean,
rowHeight: [Number, String], rowHeight: numericProp,
formatter: Function as PropType<(item: CalendarDayItem) => CalendarDayItem>, formatter: Function as PropType<(item: CalendarDayItem) => CalendarDayItem>,
lazyRender: Boolean, lazyRender: Boolean,
currentDate: [Date, Array] as PropType<Date | Date[] | null>, currentDate: [Date, Array] as PropType<Date | Date[] | null>,

View File

@ -1,7 +1,7 @@
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
// Utils // Utils
import { createNamespace, isDef } from '../utils'; import { isDef, numericProp, createNamespace } from '../utils';
// Components // Components
import { Tag } from '../tag'; import { Tag } from '../tag';
@ -14,15 +14,15 @@ export default defineComponent({
props: { props: {
tag: String, tag: String,
num: [Number, String], num: numericProp,
desc: String, desc: String,
thumb: String, thumb: String,
title: String, title: String,
price: [Number, String], price: numericProp,
centered: Boolean, centered: Boolean,
lazyLoad: Boolean, lazyLoad: Boolean,
thumbLink: String, thumbLink: String,
originPrice: [Number, String], originPrice: numericProp,
currency: { currency: {
type: String, type: String,
default: '¥', default: '¥',

View File

@ -1,5 +1,5 @@
import { nextTick, PropType, reactive, watch, defineComponent } from 'vue'; import { nextTick, PropType, reactive, watch, defineComponent } from 'vue';
import { createNamespace, truthProp, extend } from '../utils'; import { extend, numericProp, truthProp, createNamespace } from '../utils';
// Components // Components
import { Tab } from '../tab'; import { Tab } from '../tab';
@ -40,7 +40,7 @@ export default defineComponent({
title: String, title: String,
closeable: truthProp, closeable: truthProp,
swipeable: truthProp, swipeable: truthProp,
modelValue: [Number, String], modelValue: numericProp,
fieldNames: Object as PropType<CascaderFieldNames>, fieldNames: Object as PropType<CascaderFieldNames>,
placeholder: String, placeholder: String,
activeColor: String, activeColor: String,

View File

@ -2,11 +2,12 @@ import { PropType, CSSProperties, defineComponent } from 'vue';
// Utils // Utils
import { import {
createNamespace,
extend,
isDef, isDef,
extend,
truthProp, truthProp,
unknownProp, unknownProp,
numericProp,
createNamespace,
} from '../utils'; } from '../utils';
// Composables // Composables
@ -22,9 +23,9 @@ export type CellArrowDirection = 'up' | 'down' | 'left' | 'right';
export const cellProps = { export const cellProps = {
icon: String, icon: String,
size: String as PropType<'large'>, size: String as PropType<'large'>,
title: [Number, String], title: numericProp,
value: [Number, String], value: numericProp,
label: [Number, String], label: numericProp,
center: Boolean, center: Boolean,
isLink: Boolean, isLink: Boolean,
border: truthProp, border: truthProp,

View File

@ -7,7 +7,7 @@ import {
} from 'vue'; } from 'vue';
// Utils // Utils
import { createNamespace } from '../utils'; import { numericProp, createNamespace } from '../utils';
// Composables // Composables
import { useChildren, useCustomFieldValue } from '@vant/use'; import { useChildren, useCustomFieldValue } from '@vant/use';
@ -24,10 +24,10 @@ import type {
const [name, bem] = createNamespace('checkbox-group'); const [name, bem] = createNamespace('checkbox-group');
const props = { const props = {
max: [Number, String], max: numericProp,
disabled: Boolean, disabled: Boolean,
direction: String as PropType<CheckerDirection>, direction: String as PropType<CheckerDirection>,
iconSize: [Number, String], iconSize: numericProp,
checkedColor: String, checkedColor: String,
modelValue: { modelValue: {
type: Array as PropType<unknown[]>, type: Array as PropType<unknown[]>,

View File

@ -1,5 +1,5 @@
import { ref, computed, PropType, defineComponent } from 'vue'; import { ref, computed, PropType, defineComponent } from 'vue';
import { addUnit, extend, unknownProp, truthProp } from '../utils'; import { extend, addUnit, truthProp, numericProp, unknownProp } from '../utils';
import { Icon } from '../icon'; import { Icon } from '../icon';
export type CheckerShape = 'square' | 'round'; export type CheckerShape = 'square' | 'round';
@ -17,7 +17,7 @@ export type CheckerParent = {
export const checkerProps = { export const checkerProps = {
name: unknownProp, name: unknownProp,
disabled: Boolean, disabled: Boolean,
iconSize: [Number, String], iconSize: numericProp,
modelValue: unknownProp, modelValue: unknownProp,
checkedColor: String, checkedColor: String,
labelPosition: String as PropType<CheckerLabelPosition>, labelPosition: String as PropType<CheckerLabelPosition>,

View File

@ -1,6 +1,13 @@
import { watch, computed, PropType, CSSProperties, defineComponent } from 'vue'; import { watch, computed, PropType, CSSProperties, defineComponent } from 'vue';
import { raf, cancelRaf } from '@vant/use'; import { raf, cancelRaf } from '@vant/use';
import { isObject, getSizeStyle, truthProp, createNamespace } from '../utils'; import {
isObject,
truthProp,
numericProp,
getSizeStyle,
makeNumericProp,
createNamespace,
} from '../utils';
const [name, bem] = createNamespace('circle'); const [name, bem] = createNamespace('circle');
@ -22,31 +29,22 @@ export default defineComponent({
props: { props: {
text: String, text: String,
size: [Number, String], size: numericProp,
rate: makeNumericProp(100),
speed: makeNumericProp(0),
color: [String, Object] as PropType<string | Record<string, string>>, color: [String, Object] as PropType<string | Record<string, string>>,
clockwise: truthProp, clockwise: truthProp,
layerColor: String, layerColor: String,
strokeWidth: makeNumericProp(40),
strokeLinecap: String as PropType<CanvasLineCap>, strokeLinecap: String as PropType<CanvasLineCap>,
currentRate: { currentRate: {
type: Number, type: Number,
default: 0, default: 0,
}, },
speed: {
type: [Number, String],
default: 0,
},
fill: { fill: {
type: String, type: String,
default: 'none', default: 'none',
}, },
rate: {
type: [Number, String],
default: 100,
},
strokeWidth: {
type: [Number, String],
default: 40,
},
startPosition: { startPosition: {
type: String as PropType<CircleStartPosition>, type: String as PropType<CircleStartPosition>,
default: 'top', default: 'top',

View File

@ -1,5 +1,5 @@
import { computed, PropType, defineComponent } from 'vue'; import { computed, PropType, defineComponent } from 'vue';
import { createNamespace } from '../utils'; import { numericProp, createNamespace, makeNumericProp } from '../utils';
import { useParent } from '@vant/use'; import { useParent } from '@vant/use';
import { ROW_KEY } from '../row/Row'; import { ROW_KEY } from '../row/Row';
@ -9,15 +9,12 @@ export default defineComponent({
name, name,
props: { props: {
offset: [Number, String], span: makeNumericProp(0),
offset: numericProp,
tag: { tag: {
type: String as PropType<keyof HTMLElementTagNameMap>, type: String as PropType<keyof HTMLElementTagNameMap>,
default: 'div', default: 'div',
}, },
span: {
type: [Number, String],
default: 0,
},
}, },
setup(props, { slots }) { setup(props, { slots }) {

View File

@ -9,7 +9,13 @@ import {
// Utils // Utils
import { cellProps } from '../cell/Cell'; import { cellProps } from '../cell/Cell';
import { createNamespace, extend, pick, truthProp } from '../utils'; import {
pick,
extend,
truthProp,
numericProp,
createNamespace,
} from '../utils';
import { COLLAPSE_KEY } from '../collapse/Collapse'; import { COLLAPSE_KEY } from '../collapse/Collapse';
// Composables // Composables
@ -25,7 +31,7 @@ const [name, bem] = createNamespace('collapse-item');
const CELL_SLOTS = ['icon', 'title', 'value', 'label', 'right-icon'] as const; const CELL_SLOTS = ['icon', 'title', 'value', 'label', 'right-icon'] as const;
const props = extend({}, cellProps, { const props = extend({}, cellProps, {
name: [Number, String], name: numericProp,
isLink: truthProp, isLink: truthProp,
disabled: Boolean, disabled: Boolean,
readonly: Boolean, readonly: Boolean,

View File

@ -1,7 +1,7 @@
import { watch, computed, defineComponent, ExtractPropTypes } from 'vue'; import { watch, computed, defineComponent, ExtractPropTypes } from 'vue';
// Utils // Utils
import { truthProp, createNamespace } from '../utils'; import { truthProp, createNamespace, makeNumericProp } from '../utils';
import { parseFormat } from './utils'; import { parseFormat } from './utils';
// Composables // Composables
@ -11,12 +11,9 @@ import { useExpose } from '../composables/use-expose';
const [name, bem] = createNamespace('count-down'); const [name, bem] = createNamespace('count-down');
const props = { const props = {
time: makeNumericProp(0),
autoStart: truthProp, autoStart: truthProp,
millisecond: Boolean, millisecond: Boolean,
time: {
type: [Number, String],
default: 0,
},
format: { format: {
type: String, type: String,
default: 'HH:mm:ss', default: 'HH:mm:ss',

View File

@ -1,7 +1,7 @@
import { PropType, defineComponent } from 'vue'; import { PropType, defineComponent } from 'vue';
// Utils // Utils
import { isDef, truthProp, createNamespace } from '../utils'; import { isDef, truthProp, makeNumericProp, createNamespace } from '../utils';
// Components // Components
import { Cell } from '../cell'; import { Cell } from '../cell';
@ -40,6 +40,7 @@ export default defineComponent({
title: String, title: String,
border: truthProp, border: truthProp,
editable: truthProp, editable: truthProp,
chosenCoupon: makeNumericProp(-1),
coupons: { coupons: {
type: Array as PropType<CouponInfo[]>, type: Array as PropType<CouponInfo[]>,
default: () => [], default: () => [],
@ -48,10 +49,6 @@ export default defineComponent({
type: String, type: String,
default: '¥', default: '¥',
}, },
chosenCoupon: {
type: [Number, String],
default: -1,
},
}, },
setup(props) { setup(props) {

View File

@ -8,7 +8,14 @@ import {
} from 'vue'; } from 'vue';
// Utils // Utils
import { pick, clamp, extend, padZero, createNamespace } from '../utils'; import {
pick,
clamp,
extend,
padZero,
createNamespace,
makeNumericProp,
} from '../utils';
import { times, sharedProps, pickerKeys } from './utils'; import { times, sharedProps, pickerKeys } from './utils';
// Composables // Composables
@ -23,23 +30,11 @@ export default defineComponent({
name, name,
props: extend({}, sharedProps, { props: extend({}, sharedProps, {
minHour: makeNumericProp(0),
maxHour: makeNumericProp(23),
minMinute: makeNumericProp(0),
maxMinute: makeNumericProp(59),
modelValue: String, modelValue: String,
minHour: {
type: [Number, String],
default: 0,
},
maxHour: {
type: [Number, String],
default: 23,
},
minMinute: {
type: [Number, String],
default: 0,
},
maxMinute: {
type: [Number, String],
default: 59,
},
}), }),
emits: ['confirm', 'cancel', 'change', 'update:modelValue'], emits: ['confirm', 'cancel', 'change', 'update:modelValue'],

View File

@ -10,6 +10,7 @@ import {
BORDER_TOP, BORDER_TOP,
BORDER_LEFT, BORDER_LEFT,
unknownProp, unknownProp,
numericProp,
callInterceptor, callInterceptor,
createNamespace, createNamespace,
} from '../utils'; } from '../utils';
@ -43,7 +44,7 @@ export default defineComponent({
props: extend({}, popupSharedProps, { props: extend({}, popupSharedProps, {
title: String, title: String,
theme: String as PropType<DialogTheme>, theme: String as PropType<DialogTheme>,
width: [Number, String], width: numericProp,
message: [String, Function] as PropType<DialogMessage>, message: [String, Function] as PropType<DialogMessage>,
callback: Function as PropType<(action?: DialogAction) => void>, callback: Function as PropType<(action?: DialogAction) => void>,
allowHtml: Boolean, allowHtml: Boolean,

View File

@ -9,7 +9,14 @@ import {
} from 'vue'; } from 'vue';
// Utils // Utils
import { isDef, truthProp, createNamespace, ComponentInstance } from '../utils'; import {
isDef,
truthProp,
numericProp,
createNamespace,
makeNumericProp,
ComponentInstance,
} from '../utils';
// Composables // Composables
import { import {
@ -27,14 +34,11 @@ const [name, bem] = createNamespace('dropdown-menu');
const props = { const props = {
overlay: truthProp, overlay: truthProp,
zIndex: [Number, String], zIndex: numericProp,
duration: makeNumericProp(0.2),
activeColor: String, activeColor: String,
closeOnClickOutside: truthProp, closeOnClickOutside: truthProp,
closeOnClickOverlay: truthProp, closeOnClickOverlay: truthProp,
duration: {
type: [Number, String],
default: 0.2,
},
direction: { direction: {
type: String as PropType<DropdownMenuDirection>, type: String as PropType<DropdownMenuDirection>,
default: 'down', default: 'down',

View File

@ -1,5 +1,5 @@
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import { createNamespace, getSizeStyle } from '../utils'; import { createNamespace, getSizeStyle, numericProp } from '../utils';
import { Network } from './Network'; import { Network } from './Network';
const [name, bem] = createNamespace('empty'); const [name, bem] = createNamespace('empty');
@ -10,7 +10,7 @@ export default defineComponent({
name, name,
props: { props: {
imageSize: [Number, String], imageSize: numericProp,
description: String, description: String,
image: { image: {
type: String, type: String,

View File

@ -17,10 +17,12 @@ import {
extend, extend,
addUnit, addUnit,
FORM_KEY, FORM_KEY,
numericProp,
unknownProp, unknownProp,
resetScroll, resetScroll,
formatNumber, formatNumber,
preventDefault, preventDefault,
makeNumericProp,
createNamespace, createNamespace,
} from '../utils'; } from '../utils';
import { import {
@ -67,7 +69,8 @@ export const fieldSharedProps = {
rightIcon: String, rightIcon: String,
autofocus: Boolean, autofocus: Boolean,
clearable: Boolean, clearable: Boolean,
maxlength: [Number, String], maxlength: numericProp,
modelValue: makeNumericProp(''),
inputAlign: String as PropType<FieldTextAlign>, inputAlign: String as PropType<FieldTextAlign>,
placeholder: String, placeholder: String,
autocomplete: String, autocomplete: String,
@ -88,10 +91,6 @@ export const fieldSharedProps = {
type: String, type: String,
default: 'clear', default: 'clear',
}, },
modelValue: {
type: [Number, String],
default: '',
},
clearTrigger: { clearTrigger: {
type: String as PropType<FieldClearTrigger>, type: String as PropType<FieldClearTrigger>,
default: 'focus', default: 'focus',
@ -103,10 +102,10 @@ export const fieldSharedProps = {
}; };
const props = extend({}, cellProps, fieldSharedProps, { const props = extend({}, cellProps, fieldSharedProps, {
rows: [Number, String], rows: numericProp,
rules: Array as PropType<FieldRule[]>, rules: Array as PropType<FieldRule[]>,
autosize: [Boolean, Object] as PropType<boolean | FieldAutosizeConfig>, autosize: [Boolean, Object] as PropType<boolean | FieldAutosizeConfig>,
labelWidth: [Number, String], labelWidth: numericProp,
labelClass: unknownProp, labelClass: unknownProp,
labelAlign: String as PropType<FieldTextAlign>, labelAlign: String as PropType<FieldTextAlign>,
showWordLimit: Boolean, showWordLimit: Boolean,

View File

@ -1,7 +1,7 @@
import { PropType, defineComponent, ExtractPropTypes } from 'vue'; import { PropType, defineComponent, ExtractPropTypes } from 'vue';
// Utils // Utils
import { truthProp, FORM_KEY, createNamespace } from '../utils'; import { truthProp, FORM_KEY, numericProp, createNamespace } from '../utils';
// Composables // Composables
import { useChildren } from '@vant/use'; import { useChildren } from '@vant/use';
@ -22,7 +22,7 @@ const props = {
disabled: Boolean, disabled: Boolean,
readonly: Boolean, readonly: Boolean,
showError: Boolean, showError: Boolean,
labelWidth: [Number, String], labelWidth: numericProp,
labelAlign: String as PropType<FieldTextAlign>, labelAlign: String as PropType<FieldTextAlign>,
inputAlign: String as PropType<FieldTextAlign>, inputAlign: String as PropType<FieldTextAlign>,
scrollToError: Boolean, scrollToError: Boolean,

View File

@ -1,7 +1,13 @@
import { computed, CSSProperties, defineComponent } from 'vue'; import { computed, CSSProperties, defineComponent } from 'vue';
// Utils // Utils
import { createNamespace, BORDER, addUnit, extend } from '../utils'; import {
BORDER,
extend,
addUnit,
numericProp,
createNamespace,
} from '../utils';
import { GRID_KEY } from '../grid/Grid'; import { GRID_KEY } from '../grid/Grid';
// Composables // Composables
@ -21,9 +27,9 @@ export default defineComponent({
dot: Boolean, dot: Boolean,
text: String, text: String,
icon: String, icon: String,
badge: [Number, String], badge: numericProp,
iconPrefix: String,
iconColor: String, iconColor: String,
iconPrefix: String,
}), }),
setup(props, { slots }) { setup(props, { slots }) {

View File

@ -1,5 +1,11 @@
import { PropType, defineComponent, ExtractPropTypes, InjectionKey } from 'vue'; import { PropType, defineComponent, ExtractPropTypes, InjectionKey } from 'vue';
import { createNamespace, addUnit, truthProp } from '../utils'; import {
createNamespace,
addUnit,
truthProp,
numericProp,
makeNumericProp,
} from '../utils';
import { BORDER_TOP } from '../utils/constant'; import { BORDER_TOP } from '../utils/constant';
import { useChildren } from '@vant/use'; import { useChildren } from '@vant/use';
@ -11,15 +17,12 @@ const props = {
square: Boolean, square: Boolean,
center: truthProp, center: truthProp,
border: truthProp, border: truthProp,
gutter: [Number, String], gutter: numericProp,
reverse: Boolean, reverse: Boolean,
iconSize: [Number, String], iconSize: numericProp,
direction: String as PropType<GridDirection>, direction: String as PropType<GridDirection>,
clickable: Boolean, clickable: Boolean,
columnNum: { columnNum: makeNumericProp(4),
type: [Number, String],
default: 4,
},
}; };
export type GridProvide = { export type GridProvide = {

View File

@ -1,5 +1,5 @@
import { PropType, defineComponent, inject, computed } from 'vue'; import { PropType, defineComponent, inject, computed } from 'vue';
import { addUnit, createNamespace } from '../utils'; import { addUnit, numericProp, createNamespace } from '../utils';
import { Badge } from '../badge'; import { Badge } from '../badge';
import { CONFIG_PROVIDER_KEY } from '../config-provider/ConfigProvider'; import { CONFIG_PROVIDER_KEY } from '../config-provider/ConfigProvider';
@ -13,8 +13,8 @@ export default defineComponent({
props: { props: {
dot: Boolean, dot: Boolean,
name: String, name: String,
size: [Number, String], size: numericProp,
badge: [Number, String], badge: numericProp,
color: String, color: String,
classPrefix: String, classPrefix: String,
tag: { tag: {

View File

@ -18,6 +18,7 @@ import {
Interceptor, Interceptor,
callInterceptor, callInterceptor,
createNamespace, createNamespace,
makeNumericProp,
} from '../utils'; } from '../utils';
// Composables // Composables
@ -38,6 +39,8 @@ const [name, bem] = createNamespace('image-preview');
const props = { const props = {
show: Boolean, show: Boolean,
loop: truthProp, loop: truthProp,
minZoom: makeNumericProp(1 / 3),
maxZoom: makeNumericProp(3),
overlay: truthProp, overlay: truthProp,
closeable: Boolean, closeable: Boolean,
showIndex: truthProp, showIndex: truthProp,
@ -45,28 +48,14 @@ const props = {
transition: String, transition: String,
beforeClose: Function as PropType<Interceptor>, beforeClose: Function as PropType<Interceptor>,
overlayStyle: Object as PropType<CSSProperties>, overlayStyle: Object as PropType<CSSProperties>,
swipeDuration: makeNumericProp(300),
startPosition: makeNumericProp(0),
showIndicators: Boolean, showIndicators: Boolean,
closeOnPopstate: truthProp, closeOnPopstate: truthProp,
images: { images: {
type: Array as PropType<string[]>, type: Array as PropType<string[]>,
default: () => [], default: () => [],
}, },
minZoom: {
type: [Number, String],
default: 1 / 3,
},
maxZoom: {
type: [Number, String],
default: 3,
},
swipeDuration: {
type: [Number, String],
default: 300,
},
startPosition: {
type: [Number, String],
default: 0,
},
closeIcon: { closeIcon: {
type: String, type: String,
default: 'clear', default: 'clear',

View File

@ -1,7 +1,7 @@
import { watch, computed, reactive, CSSProperties, defineComponent } from 'vue'; import { watch, computed, reactive, CSSProperties, defineComponent } from 'vue';
// Utils // Utils
import { clamp, preventDefault, createNamespace } from '../utils'; import { clamp, preventDefault, numericProp, createNamespace } from '../utils';
// Composables // Composables
import { useTouch } from '../composables/use-touch'; import { useTouch } from '../composables/use-touch';
@ -25,11 +25,11 @@ export default defineComponent({
show: Boolean, show: Boolean,
active: Number, active: Number,
minZoom: { minZoom: {
type: [Number, String], type: numericProp,
required: true, required: true,
}, },
maxZoom: { maxZoom: {
type: [Number, String], type: numericProp,
required: true, required: true,
}, },
rootWidth: { rootWidth: {

View File

@ -15,6 +15,7 @@ import {
addUnit, addUnit,
inBrowser, inBrowser,
truthProp, truthProp,
numericProp,
createNamespace, createNamespace,
} from '../utils'; } from '../utils';
@ -33,11 +34,11 @@ export default defineComponent({
alt: String, alt: String,
fit: String as PropType<ImageFit>, fit: String as PropType<ImageFit>,
round: Boolean, round: Boolean,
width: [Number, String], width: numericProp,
height: [Number, String], height: numericProp,
radius: [Number, String], radius: numericProp,
lazyLoad: Boolean, lazyLoad: Boolean,
iconSize: [Number, String], iconSize: numericProp,
showError: truthProp, showError: truthProp,
iconPrefix: String, iconPrefix: String,
showLoading: truthProp, showLoading: truthProp,

View File

@ -3,6 +3,7 @@ import { ref, reactive, computed, CSSProperties, defineComponent } from 'vue';
// Utils // Utils
import { import {
extend, extend,
numericProp,
BORDER_BOTTOM, BORDER_BOTTOM,
getZIndexStyle, getZIndexStyle,
createNamespace, createNamespace,
@ -20,7 +21,7 @@ export default defineComponent({
name, name,
props: { props: {
index: [Number, String], index: numericProp,
}, },
setup(props, { slots }) { setup(props, { slots }) {

View File

@ -18,6 +18,7 @@ import {
isDef, isDef,
isHidden, isHidden,
truthProp, truthProp,
numericProp,
getScrollTop, getScrollTop,
preventDefault, preventDefault,
createNamespace, createNamespace,
@ -51,7 +52,7 @@ const [name, bem] = createNamespace('index-bar');
const props = { const props = {
sticky: truthProp, sticky: truthProp,
zIndex: [Number, String], zIndex: numericProp,
teleport: [String, Object] as PropType<TeleportProps['to']>, teleport: [String, Object] as PropType<TeleportProps['to']>,
highlightColor: String, highlightColor: String,
stickyOffsetTop: { stickyOffsetTop: {

View File

@ -10,7 +10,12 @@ import {
} from 'vue'; } from 'vue';
// Utils // Utils
import { isHidden, truthProp, createNamespace } from '../utils'; import {
isHidden,
truthProp,
createNamespace,
makeNumericProp,
} from '../utils';
// Composables // Composables
import { useRect, useScrollParent, useEventListener } from '@vant/use'; import { useRect, useScrollParent, useEventListener } from '@vant/use';
@ -27,16 +32,13 @@ const [name, bem, t] = createNamespace('list');
const props = { const props = {
error: Boolean, error: Boolean,
offset: makeNumericProp(300),
loading: Boolean, loading: Boolean,
finished: Boolean, finished: Boolean,
errorText: String, errorText: String,
loadingText: String, loadingText: String,
finishedText: String, finishedText: String,
immediateCheck: truthProp, immediateCheck: truthProp,
offset: {
type: [Number, String],
default: 300,
},
direction: { direction: {
type: String as PropType<ListDirection>, type: String as PropType<ListDirection>,
default: 'down', default: 'down',

View File

@ -1,5 +1,11 @@
import { computed, PropType, defineComponent } from 'vue'; import { computed, PropType, defineComponent } from 'vue';
import { createNamespace, addUnit, getSizeStyle, extend } from '../utils'; import {
extend,
addUnit,
numericProp,
getSizeStyle,
createNamespace,
} from '../utils';
const [name, bem] = createNamespace('loading'); const [name, bem] = createNamespace('loading');
@ -19,10 +25,10 @@ export default defineComponent({
name, name,
props: { props: {
size: [Number, String], size: numericProp,
color: String, color: String,
vertical: Boolean, vertical: Boolean,
textSize: [Number, String], textSize: numericProp,
textColor: String, textColor: String,
type: { type: {
type: String as PropType<LoadingType>, type: String as PropType<LoadingType>,

View File

@ -3,6 +3,7 @@ import { ref, CSSProperties, defineComponent } from 'vue';
// Utils // Utils
import { import {
truthProp, truthProp,
numericProp,
BORDER_BOTTOM, BORDER_BOTTOM,
getZIndexStyle, getZIndexStyle,
createNamespace, createNamespace,
@ -22,7 +23,7 @@ export default defineComponent({
props: { props: {
title: String, title: String,
fixed: Boolean, fixed: Boolean,
zIndex: [Number, String], zIndex: numericProp,
border: truthProp, border: truthProp,
leftText: String, leftText: String,
rightText: String, rightText: String,

View File

@ -8,7 +8,7 @@ import {
} from 'vue'; } from 'vue';
// Utils // Utils
import { isDef, createNamespace } from '../utils'; import { isDef, createNamespace, makeNumericProp } from '../utils';
// Composables // Composables
import { import {
@ -33,6 +33,8 @@ const props = {
text: String, text: String,
mode: String as PropType<NoticeBarMode>, mode: String as PropType<NoticeBarMode>,
color: String, color: String,
delay: makeNumericProp(1),
speed: makeNumericProp(60),
leftIcon: String, leftIcon: String,
wrapable: Boolean, wrapable: Boolean,
background: String, background: String,
@ -40,14 +42,6 @@ const props = {
type: Boolean as PropType<boolean | null>, type: Boolean as PropType<boolean | null>,
default: null, default: null,
}, },
delay: {
type: [Number, String],
default: 1,
},
speed: {
type: [Number, String],
default: 60,
},
}; };
export type NoticeBarProps = ExtractPropTypes<typeof props>; export type NoticeBarProps = ExtractPropTypes<typeof props>;

View File

@ -1,5 +1,5 @@
import { PropType, defineComponent } from 'vue'; import { PropType, defineComponent } from 'vue';
import { createNamespace, extend, unknownProp } from '../utils'; import { extend, numericProp, unknownProp, createNamespace } from '../utils';
import { Popup } from '../popup'; import { Popup } from '../popup';
import { popupSharedProps } from '../popup/shared'; import { popupSharedProps } from '../popup/shared';
import type { NotifyType } from './types'; import type { NotifyType } from './types';
@ -11,7 +11,7 @@ export default defineComponent({
props: extend({}, popupSharedProps, { props: extend({}, popupSharedProps, {
color: String, color: String,
message: [Number, String], message: numericProp,
className: unknownProp, className: unknownProp,
background: String, background: String,
lockScroll: Boolean, lockScroll: Boolean,

View File

@ -13,9 +13,11 @@ import {
// Utils // Utils
import { import {
truthProp, truthProp,
numericProp,
getZIndexStyle, getZIndexStyle,
stopPropagation, stopPropagation,
createNamespace, createNamespace,
makeNumericProp,
} from '../utils'; } from '../utils';
// Composables // Composables
@ -41,8 +43,9 @@ export default defineComponent({
props: { props: {
show: Boolean, show: Boolean,
title: String, title: String,
zIndex: [Number, String], zIndex: numericProp,
teleport: [String, Object] as PropType<TeleportProps['to']>, teleport: [String, Object] as PropType<TeleportProps['to']>,
maxlength: makeNumericProp(Number.MAX_VALUE),
transition: truthProp, transition: truthProp,
blurOnClose: truthProp, blurOnClose: truthProp,
showDeleteKey: truthProp, showDeleteKey: truthProp,
@ -64,10 +67,6 @@ export default defineComponent({
type: [String, Array] as PropType<string | string[]>, type: [String, Array] as PropType<string | string[]>,
default: '', default: '',
}, },
maxlength: {
type: [Number, String],
default: Number.MAX_VALUE,
},
}, },
emits: [ emits: [

View File

@ -1,5 +1,5 @@
import { ref, PropType, defineComponent } from 'vue'; import { ref, PropType, defineComponent } from 'vue';
import { createNamespace } from '../utils'; import { numericProp, createNamespace } from '../utils';
import { useTouch } from '../composables/use-touch'; import { useTouch } from '../composables/use-touch';
import { Loading } from '../loading'; import { Loading } from '../loading';
@ -30,7 +30,7 @@ export default defineComponent({
props: { props: {
type: String as PropType<KeyType>, type: String as PropType<KeyType>,
text: [Number, String], text: numericProp,
color: String, color: String,
wider: Boolean, wider: Boolean,
large: Boolean, large: Boolean,

View File

@ -4,6 +4,7 @@ import {
isDef, isDef,
extend, extend,
truthProp, truthProp,
numericProp,
unknownProp, unknownProp,
preventDefault, preventDefault,
createNamespace, createNamespace,
@ -18,8 +19,8 @@ export default defineComponent({
props: { props: {
show: Boolean, show: Boolean,
zIndex: [Number, String], zIndex: numericProp,
duration: [Number, String], duration: numericProp,
className: unknownProp, className: unknownProp,
lockScroll: truthProp, lockScroll: truthProp,
customStyle: Object as PropType<CSSProperties>, customStyle: Object as PropType<CSSProperties>,

View File

@ -1,5 +1,5 @@
import { computed, watch, PropType, defineComponent } from 'vue'; import { computed, watch, PropType, defineComponent } from 'vue';
import { BORDER, createNamespace } from '../utils'; import { BORDER, makeNumericProp, createNamespace } from '../utils';
const [name, bem, t] = createNamespace('pagination'); const [name, bem, t] = createNamespace('pagination');
@ -23,6 +23,10 @@ export default defineComponent({
props: { props: {
prevText: String, prevText: String,
nextText: String, nextText: String,
pageCount: makeNumericProp(0),
totalItems: makeNumericProp(0),
showPageSize: makeNumericProp(5),
itemsPerPage: makeNumericProp(10),
forceEllipses: Boolean, forceEllipses: Boolean,
mode: { mode: {
type: String as PropType<PaginationMode>, type: String as PropType<PaginationMode>,
@ -32,22 +36,6 @@ export default defineComponent({
type: Number, type: Number,
default: 0, default: 0,
}, },
pageCount: {
type: [Number, String],
default: 0,
},
totalItems: {
type: [Number, String],
default: 0,
},
itemsPerPage: {
type: [Number, String],
default: 10,
},
showPageSize: {
type: [Number, String],
default: 5,
},
}, },
emits: ['change', 'update:modelValue'], emits: ['change', 'update:modelValue'],

View File

@ -2,9 +2,11 @@ import { defineComponent } from 'vue';
import { import {
addUnit, addUnit,
truthProp, truthProp,
numericProp,
BORDER_LEFT, BORDER_LEFT,
BORDER_SURROUND, BORDER_SURROUND,
createNamespace, createNamespace,
makeNumericProp,
} from '../utils'; } from '../utils';
const [name, bem] = createNamespace('password-input'); const [name, bem] = createNamespace('password-input');
@ -15,17 +17,14 @@ export default defineComponent({
props: { props: {
info: String, info: String,
mask: truthProp, mask: truthProp,
gutter: [Number, String], gutter: numericProp,
length: makeNumericProp(6),
focused: Boolean, focused: Boolean,
errorInfo: String, errorInfo: String,
value: { value: {
type: String, type: String,
default: '', default: '',
}, },
length: {
type: [Number, String],
default: 6,
},
}, },
emits: ['focus'], emits: ['focus'],

View File

@ -14,6 +14,7 @@ import {
truthProp, truthProp,
preventDefault, preventDefault,
createNamespace, createNamespace,
makeNumericProp,
BORDER_UNSET_TOP_BOTTOM, BORDER_UNSET_TOP_BOTTOM,
} from '../utils'; } from '../utils';
@ -42,21 +43,12 @@ export const pickerProps = {
loading: Boolean, loading: Boolean,
readonly: Boolean, readonly: Boolean,
allowHtml: Boolean, allowHtml: Boolean,
itemHeight: makeNumericProp(44),
showToolbar: truthProp, showToolbar: truthProp,
swipeDuration: makeNumericProp(1000),
visibleItemCount: makeNumericProp(6),
cancelButtonText: String, cancelButtonText: String,
confirmButtonText: String, confirmButtonText: String,
itemHeight: {
type: [Number, String],
default: 44,
},
visibleItemCount: {
type: [Number, String],
default: 6,
},
swipeDuration: {
type: [Number, String],
default: 1000,
},
}; };
export type PickerProps = ExtractPropTypes<typeof pickerProps>; export type PickerProps = ExtractPropTypes<typeof pickerProps>;
@ -68,15 +60,12 @@ export default defineComponent({
// @deprecated // @deprecated
// should be removed in next major version // should be removed in next major version
valueKey: String, valueKey: String,
defaultIndex: makeNumericProp(0),
columnsFieldNames: Object as PropType<PickerFieldNames>, columnsFieldNames: Object as PropType<PickerFieldNames>,
columns: { columns: {
type: Array as PropType<PickerOption[] | PickerColumn[]>, type: Array as PropType<PickerOption[] | PickerColumn[]>,
default: () => [], default: () => [],
}, },
defaultIndex: {
type: [Number, String],
default: 0,
},
toolbarPosition: { toolbarPosition: {
type: String as PropType<PickerToolbarPosition>, type: String as PropType<PickerToolbarPosition>,
default: 'top', default: 'top',

View File

@ -6,6 +6,7 @@ import {
clamp, clamp,
isObject, isObject,
unknownProp, unknownProp,
numericProp,
preventDefault, preventDefault,
createNamespace, createNamespace,
} from '../utils'; } from '../utils';
@ -55,11 +56,11 @@ export default defineComponent({
required: true, required: true,
}, },
swipeDuration: { swipeDuration: {
type: [Number, String], type: numericProp,
required: true, required: true,
}, },
visibleItemCount: { visibleItemCount: {
type: [Number, String], type: numericProp,
required: true, required: true,
}, },
defaultIndex: { defaultIndex: {

View File

@ -16,6 +16,7 @@ import {
pick, pick,
extend, extend,
truthProp, truthProp,
numericProp,
unknownProp, unknownProp,
BORDER_BOTTOM, BORDER_BOTTOM,
createNamespace, createNamespace,
@ -72,7 +73,7 @@ export default defineComponent({
props: { props: {
show: Boolean, show: Boolean,
overlay: Boolean, overlay: Boolean,
duration: [Number, String], duration: numericProp,
iconPrefix: String, iconPrefix: String,
overlayClass: unknownProp, overlayClass: unknownProp,
overlayStyle: Object as PropType<CSSProperties>, overlayStyle: Object as PropType<CSSProperties>,

View File

@ -1,15 +1,15 @@
import { PropType, CSSProperties, TeleportProps } from 'vue'; import { PropType, CSSProperties, TeleportProps } from 'vue';
import { truthProp, unknownProp, Interceptor } from '../utils'; import { truthProp, unknownProp, Interceptor, numericProp } from '../utils';
export const popupSharedProps = { export const popupSharedProps = {
// whether to show popup // whether to show popup
show: Boolean, show: Boolean,
// z-index // z-index
zIndex: [Number, String], zIndex: numericProp,
// whether to show overlay // whether to show overlay
overlay: truthProp, overlay: truthProp,
// transition duration // transition duration
duration: [Number, String], duration: numericProp,
// teleport // teleport
teleport: [String, Object] as PropType<TeleportProps['to']>, teleport: [String, Object] as PropType<TeleportProps['to']>,
// prevent body scroll // prevent body scroll

View File

@ -1,5 +1,5 @@
import { computed, defineComponent, ExtractPropTypes } from 'vue'; import { computed, defineComponent, ExtractPropTypes } from 'vue';
import { truthProp, createNamespace, addUnit } from '../utils'; import { addUnit, truthProp, numericProp, createNamespace } from '../utils';
const [name, bem] = createNamespace('progress'); const [name, bem] = createNamespace('progress');
@ -11,9 +11,9 @@ const props = {
showPivot: truthProp, showPivot: truthProp,
pivotColor: String, pivotColor: String,
trackColor: String, trackColor: String,
strokeWidth: [Number, String], strokeWidth: numericProp,
percentage: { percentage: {
type: [Number, String], type: numericProp,
default: 0, default: 0,
validator: (value: number | string) => value >= 0 && value <= 100, validator: (value: number | string) => value >= 0 && value <= 100,
}, },

View File

@ -1,7 +1,13 @@
import { ref, watch, reactive, nextTick, defineComponent } from 'vue'; import { ref, watch, reactive, nextTick, defineComponent } from 'vue';
// Utils // Utils
import { preventDefault, getScrollTop, createNamespace } from '../utils'; import {
numericProp,
getScrollTop,
preventDefault,
createNamespace,
makeNumericProp,
} from '../utils';
// Composables // Composables
import { useScrollParent } from '@vant/use'; import { useScrollParent } from '@vant/use';
@ -27,27 +33,15 @@ export default defineComponent({
props: { props: {
disabled: Boolean, disabled: Boolean,
modelValue: Boolean,
headHeight: makeNumericProp(DEFAULT_HEAD_HEIGHT),
successText: String, successText: String,
pullingText: String, pullingText: String,
loosingText: String, loosingText: String,
loadingText: String, loadingText: String,
pullDistance: [Number, String], pullDistance: numericProp,
modelValue: { successDuration: makeNumericProp(500),
type: Boolean, animationDuration: makeNumericProp(300),
default: false,
},
successDuration: {
type: [Number, String],
default: 500,
},
animationDuration: {
type: [Number, String],
default: 300,
},
headHeight: {
type: [Number, String],
default: DEFAULT_HEAD_HEIGHT,
},
}, },
emits: ['refresh', 'update:modelValue'], emits: ['refresh', 'update:modelValue'],

View File

@ -5,7 +5,7 @@ import {
defineComponent, defineComponent,
ExtractPropTypes, ExtractPropTypes,
} from 'vue'; } from 'vue';
import { unknownProp, createNamespace } from '../utils'; import { unknownProp, numericProp, createNamespace } from '../utils';
import { useChildren, useCustomFieldValue } from '@vant/use'; import { useChildren, useCustomFieldValue } from '@vant/use';
import type { CheckerDirection } from '../checkbox/Checker'; import type { CheckerDirection } from '../checkbox/Checker';
@ -13,7 +13,7 @@ const [name, bem] = createNamespace('radio-group');
const props = { const props = {
disabled: Boolean, disabled: Boolean,
iconSize: [Number, String], iconSize: numericProp,
direction: String as PropType<CheckerDirection>, direction: String as PropType<CheckerDirection>,
modelValue: unknownProp, modelValue: unknownProp,
checkedColor: String, checkedColor: String,

View File

@ -1,7 +1,14 @@
import { computed, defineComponent } from 'vue'; import { computed, defineComponent } from 'vue';
// Utils // Utils
import { addUnit, truthProp, createNamespace, preventDefault } from '../utils'; import {
addUnit,
truthProp,
numericProp,
preventDefault,
createNamespace,
makeNumericProp,
} from '../utils';
// Composables // Composables
import { useCustomFieldValue } from '@vant/use'; import { useCustomFieldValue } from '@vant/use';
@ -49,9 +56,10 @@ export default defineComponent({
name, name,
props: { props: {
size: [Number, String], size: numericProp,
color: String, color: String,
gutter: [Number, String], count: makeNumericProp(5),
gutter: numericProp,
readonly: Boolean, readonly: Boolean,
disabled: Boolean, disabled: Boolean,
allowHalf: Boolean, allowHalf: Boolean,
@ -71,10 +79,6 @@ export default defineComponent({
type: String, type: String,
default: 'star-o', default: 'star-o',
}, },
count: {
type: [Number, String],
default: 5,
},
}, },
emits: ['change', 'update:modelValue'], emits: ['change', 'update:modelValue'],

View File

@ -5,7 +5,7 @@ import {
InjectionKey, InjectionKey,
defineComponent, defineComponent,
} from 'vue'; } from 'vue';
import { truthProp, createNamespace } from '../utils'; import { truthProp, makeNumericProp, createNamespace } from '../utils';
import { useChildren } from '@vant/use'; import { useChildren } from '@vant/use';
const [name, bem] = createNamespace('row'); const [name, bem] = createNamespace('row');
@ -33,15 +33,12 @@ export default defineComponent({
props: { props: {
wrap: truthProp, wrap: truthProp,
align: String as PropType<RowAlign>, align: String as PropType<RowAlign>,
gutter: makeNumericProp(0),
justify: String as PropType<RowJustify>, justify: String as PropType<RowJustify>,
tag: { tag: {
type: String as PropType<keyof HTMLElementTagNameMap>, type: String as PropType<keyof HTMLElementTagNameMap>,
default: 'div', default: 'div',
}, },
gutter: {
type: [Number, String],
default: 0,
},
}, },
setup(props, { slots }) { setup(props, { slots }) {

View File

@ -1,7 +1,7 @@
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
// Utils // Utils
import { createNamespace, extend } from '../utils'; import { extend, numericProp, createNamespace } from '../utils';
import { SIDEBAR_KEY } from '../sidebar/Sidebar'; import { SIDEBAR_KEY } from '../sidebar/Sidebar';
// Composables // Composables
@ -19,7 +19,7 @@ export default defineComponent({
props: extend({}, routeProps, { props: extend({}, routeProps, {
dot: Boolean, dot: Boolean,
title: String, title: String,
badge: [Number, String], badge: numericProp,
disabled: Boolean, disabled: Boolean,
}), }),

View File

@ -1,5 +1,5 @@
import { defineComponent, InjectionKey } from 'vue'; import { defineComponent, InjectionKey } from 'vue';
import { createNamespace } from '../utils'; import { makeNumericProp, createNamespace } from '../utils';
import { useChildren } from '@vant/use'; import { useChildren } from '@vant/use';
const [name, bem] = createNamespace('sidebar'); const [name, bem] = createNamespace('sidebar');
@ -15,10 +15,7 @@ export default defineComponent({
name, name,
props: { props: {
modelValue: { modelValue: makeNumericProp(0),
type: [Number, String],
default: 0,
},
}, },
emits: ['change', 'update:modelValue'], emits: ['change', 'update:modelValue'],

View File

@ -1,5 +1,12 @@
import { PropType, defineComponent } from 'vue'; import { PropType, defineComponent } from 'vue';
import { addUnit, truthProp, getSizeStyle, createNamespace } from '../utils'; import {
addUnit,
truthProp,
numericProp,
getSizeStyle,
createNamespace,
makeNumericProp,
} from '../utils';
const [name, bem] = createNamespace('skeleton'); const [name, bem] = createNamespace('skeleton');
const DEFAULT_ROW_WIDTH = '100%'; const DEFAULT_ROW_WIDTH = '100%';
@ -9,17 +16,14 @@ export default defineComponent({
name, name,
props: { props: {
row: makeNumericProp(0),
title: Boolean, title: Boolean,
round: Boolean, round: Boolean,
avatar: Boolean, avatar: Boolean,
loading: truthProp, loading: truthProp,
animate: truthProp, animate: truthProp,
avatarSize: [Number, String], avatarSize: numericProp,
titleWidth: [Number, String], titleWidth: numericProp,
row: {
type: [Number, String],
default: 0,
},
avatarShape: { avatarShape: {
type: String as PropType<'square' | 'round'>, type: String as PropType<'square' | 'round'>,
default: 'round', default: 'round',

View File

@ -5,10 +5,12 @@ import {
clamp, clamp,
addUnit, addUnit,
addNumber, addNumber,
numericProp,
getSizeStyle, getSizeStyle,
preventDefault, preventDefault,
stopPropagation, stopPropagation,
createNamespace, createNamespace,
makeNumericProp,
} from '../utils'; } from '../utils';
// Composables // Composables
@ -25,27 +27,18 @@ export default defineComponent({
name, name,
props: { props: {
min: makeNumericProp(0),
max: makeNumericProp(100),
step: makeNumericProp(1),
range: Boolean, range: Boolean,
reverse: Boolean, reverse: Boolean,
disabled: Boolean, disabled: Boolean,
readonly: Boolean, readonly: Boolean,
vertical: Boolean, vertical: Boolean,
barHeight: [Number, String], barHeight: numericProp,
buttonSize: [Number, String], buttonSize: numericProp,
activeColor: String, activeColor: String,
inactiveColor: String, inactiveColor: String,
min: {
type: [Number, String],
default: 0,
},
max: {
type: [Number, String],
default: 100,
},
step: {
type: [Number, String],
default: 1,
},
modelValue: { modelValue: {
type: [Number, Array] as PropType<SliderValue>, type: [Number, Array] as PropType<SliderValue>,
default: 0, default: 0,

View File

@ -8,11 +8,13 @@ import {
truthProp, truthProp,
resetScroll, resetScroll,
Interceptor, Interceptor,
numericProp,
formatNumber, formatNumber,
getSizeStyle, getSizeStyle,
preventDefault, preventDefault,
createNamespace, createNamespace,
callInterceptor, callInterceptor,
makeNumericProp,
} from '../utils'; } from '../utils';
// Composables // Composables
@ -32,6 +34,10 @@ export default defineComponent({
name, name,
props: { props: {
min: makeNumericProp(1),
max: makeNumericProp(Infinity),
name: makeNumericProp(''),
step: makeNumericProp(1),
theme: String as PropType<StepperTheme>, theme: String as PropType<StepperTheme>,
integer: Boolean, integer: Boolean,
disabled: Boolean, disabled: Boolean,
@ -40,35 +46,16 @@ export default defineComponent({
showInput: truthProp, showInput: truthProp,
longPress: truthProp, longPress: truthProp,
allowEmpty: Boolean, allowEmpty: Boolean,
modelValue: [Number, String], modelValue: numericProp,
inputWidth: [Number, String], inputWidth: numericProp,
buttonSize: [Number, String], buttonSize: numericProp,
placeholder: String, placeholder: String,
disablePlus: Boolean, disablePlus: Boolean,
disableMinus: Boolean, disableMinus: Boolean,
disableInput: Boolean, disableInput: Boolean,
beforeChange: Function as PropType<Interceptor>, beforeChange: Function as PropType<Interceptor>,
decimalLength: [Number, String], defaultValue: makeNumericProp(1),
name: { decimalLength: numericProp,
type: [Number, String],
default: '',
},
min: {
type: [Number, String],
default: 1,
},
max: {
type: [Number, String],
default: Infinity,
},
step: {
type: [Number, String],
default: 1,
},
defaultValue: {
type: [Number, String],
default: 1,
},
}, },
emits: [ emits: [

View File

@ -1,5 +1,5 @@
import { PropType, defineComponent, ExtractPropTypes, InjectionKey } from 'vue'; import { PropType, defineComponent, ExtractPropTypes, InjectionKey } from 'vue';
import { createNamespace } from '../utils'; import { makeNumericProp, createNamespace } from '../utils';
import { useChildren } from '@vant/use'; import { useChildren } from '@vant/use';
const [name, bem] = createNamespace('steps'); const [name, bem] = createNamespace('steps');
@ -7,15 +7,12 @@ const [name, bem] = createNamespace('steps');
export type StepsDirection = 'horizontal' | 'vertical'; export type StepsDirection = 'horizontal' | 'vertical';
const props = { const props = {
active: makeNumericProp(0),
iconPrefix: String, iconPrefix: String,
finishIcon: String, finishIcon: String,
activeColor: String, activeColor: String,
inactiveIcon: String, inactiveIcon: String,
inactiveColor: String, inactiveColor: String,
active: {
type: [Number, String],
default: 0,
},
direction: { direction: {
type: String as PropType<StepsDirection>, type: String as PropType<StepsDirection>,
default: 'horizontal', default: 'horizontal',

View File

@ -13,9 +13,11 @@ import {
extend, extend,
isHidden, isHidden,
unitToPx, unitToPx,
numericProp,
getScrollTop, getScrollTop,
getZIndexStyle, getZIndexStyle,
createNamespace, createNamespace,
makeNumericProp,
} from '../utils'; } from '../utils';
// Composables // Composables
@ -30,16 +32,10 @@ export default defineComponent({
name, name,
props: { props: {
zIndex: [Number, String], zIndex: numericProp,
container: Object as PropType<Element>, container: Object as PropType<Element>,
offsetTop: { offsetTop: makeNumericProp(0),
type: [Number, String], offsetBottom: makeNumericProp(0),
default: 0,
},
offsetBottom: {
type: [Number, String],
default: 0,
},
position: { position: {
type: String as PropType<StickyPosition>, type: String as PropType<StickyPosition>,
default: 'top', default: 'top',

View File

@ -1,5 +1,5 @@
import { PropType, CSSProperties, defineComponent } from 'vue'; import { PropType, CSSProperties, defineComponent } from 'vue';
import { truthProp, createNamespace } from '../utils'; import { truthProp, makeNumericProp, createNamespace } from '../utils';
// Components // Components
import { Icon } from '../icon'; import { Icon } from '../icon';
@ -21,11 +21,8 @@ export default defineComponent({
buttonText: String, buttonText: String,
buttonColor: String, buttonColor: String,
suffixLabel: String, suffixLabel: String,
decimalLength: makeNumericProp(2),
safeAreaInsetBottom: truthProp, safeAreaInsetBottom: truthProp,
decimalLength: {
type: [Number, String],
default: 2,
},
currency: { currency: {
type: String, type: String,
default: '¥', default: '¥',

View File

@ -12,10 +12,12 @@ import {
import { import {
clamp, clamp,
isDef, isDef,
numericProp,
Interceptor, Interceptor,
preventDefault, preventDefault,
callInterceptor, callInterceptor,
createNamespace, createNamespace,
makeNumericProp,
} from '../utils'; } from '../utils';
// Composables // Composables
@ -33,15 +35,12 @@ import type {
const [name, bem] = createNamespace('swipe-cell'); const [name, bem] = createNamespace('swipe-cell');
const props = { const props = {
name: makeNumericProp(''),
disabled: Boolean, disabled: Boolean,
leftWidth: [Number, String], leftWidth: numericProp,
rightWidth: [Number, String], rightWidth: numericProp,
beforeClose: Function as PropType<Interceptor>, beforeClose: Function as PropType<Interceptor>,
stopPropagation: Boolean, stopPropagation: Boolean,
name: {
type: [Number, String],
default: '',
},
}; };
export type SwipeCellProps = ExtractPropTypes<typeof props>; export type SwipeCellProps = ExtractPropTypes<typeof props>;

View File

@ -18,8 +18,10 @@ import {
clamp, clamp,
isHidden, isHidden,
truthProp, truthProp,
numericProp,
preventDefault, preventDefault,
createNamespace, createNamespace,
makeNumericProp,
} from '../utils'; } from '../utils';
// Composables // Composables
@ -40,26 +42,17 @@ const [name, bem] = createNamespace('swipe');
const props = { const props = {
loop: truthProp, loop: truthProp,
width: [Number, String], width: numericProp,
height: [Number, String], height: numericProp,
vertical: Boolean, vertical: Boolean,
autoplay: makeNumericProp(0),
duration: makeNumericProp(500),
touchable: truthProp, touchable: truthProp,
lazyRender: Boolean, lazyRender: Boolean,
initialSwipe: makeNumericProp(0),
indicatorColor: String, indicatorColor: String,
showIndicators: truthProp, showIndicators: truthProp,
stopPropagation: truthProp, stopPropagation: truthProp,
autoplay: {
type: [Number, String],
default: 0,
},
duration: {
type: [Number, String],
default: 500,
},
initialSwipe: {
type: [Number, String],
default: 0,
},
}; };
export type SwipeProps = ExtractPropTypes<typeof props>; export type SwipeProps = ExtractPropTypes<typeof props>;

View File

@ -1,5 +1,5 @@
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import { createNamespace, addUnit, unknownProp } from '../utils'; import { addUnit, numericProp, unknownProp, createNamespace } from '../utils';
import { useCustomFieldValue } from '@vant/use'; import { useCustomFieldValue } from '@vant/use';
import { Loading } from '../loading'; import { Loading } from '../loading';
@ -9,7 +9,7 @@ export default defineComponent({
name, name,
props: { props: {
size: [Number, String], size: numericProp,
loading: Boolean, loading: Boolean,
disabled: Boolean, disabled: Boolean,
modelValue: unknownProp, modelValue: unknownProp,

View File

@ -10,7 +10,13 @@ import {
} from 'vue'; } from 'vue';
// Utils // Utils
import { createNamespace, extend, truthProp, unknownProp } from '../utils'; import {
extend,
truthProp,
unknownProp,
numericProp,
createNamespace,
} from '../utils';
import { TABS_KEY } from '../tabs/Tabs'; import { TABS_KEY } from '../tabs/Tabs';
// Composables // Composables
@ -28,8 +34,8 @@ export default defineComponent({
props: extend({}, routeProps, { props: extend({}, routeProps, {
dot: Boolean, dot: Boolean,
name: [Number, String], name: numericProp,
badge: [Number, String], badge: numericProp,
title: String, title: String,
disabled: Boolean, disabled: Boolean,
titleClass: unknownProp, titleClass: unknownProp,

View File

@ -1,7 +1,7 @@
import { computed, getCurrentInstance, defineComponent } from 'vue'; import { computed, getCurrentInstance, defineComponent } from 'vue';
// Utils // Utils
import { createNamespace, extend, isObject } from '../utils'; import { createNamespace, extend, isObject, numericProp } from '../utils';
import { TABBAR_KEY } from '../tabbar/Tabbar'; import { TABBAR_KEY } from '../tabbar/Tabbar';
// Composables // Composables
@ -20,8 +20,8 @@ export default defineComponent({
props: extend({}, routeProps, { props: extend({}, routeProps, {
dot: Boolean, dot: Boolean,
icon: String, icon: String,
name: [Number, String], name: numericProp,
badge: [Number, String], badge: numericProp,
iconPrefix: String, iconPrefix: String,
}), }),

View File

@ -10,9 +10,11 @@ import {
import { import {
truthProp, truthProp,
Interceptor, Interceptor,
numericProp,
getZIndexStyle, getZIndexStyle,
createNamespace, createNamespace,
callInterceptor, callInterceptor,
makeNumericProp,
BORDER_TOP_BOTTOM, BORDER_TOP_BOTTOM,
} from '../utils'; } from '../utils';
@ -26,15 +28,12 @@ const props = {
route: Boolean, route: Boolean,
fixed: truthProp, fixed: truthProp,
border: truthProp, border: truthProp,
zIndex: [Number, String], zIndex: numericProp,
placeholder: Boolean, placeholder: Boolean,
activeColor: String, activeColor: String,
beforeChange: Function as PropType<Interceptor>, beforeChange: Function as PropType<Interceptor>,
inactiveColor: String, inactiveColor: String,
modelValue: { modelValue: makeNumericProp(0),
type: [Number, String],
default: 0,
},
safeAreaInsetBottom: { safeAreaInsetBottom: {
type: Boolean as PropType<boolean | null>, type: Boolean as PropType<boolean | null>,
default: null, default: null,

View File

@ -16,21 +16,23 @@ import {
// Utils // Utils
import { import {
pick,
isDef, isDef,
addUnit, addUnit,
isHidden, isHidden,
unitToPx, unitToPx,
truthProp, truthProp,
numericProp,
Interceptor, Interceptor,
getVisibleTop, getVisibleTop,
getElementTop, getElementTop,
callInterceptor, callInterceptor,
createNamespace, createNamespace,
makeNumericProp,
getVisibleHeight, getVisibleHeight,
setRootScrollTop, setRootScrollTop,
ComponentInstance, ComponentInstance,
BORDER_TOP_BOTTOM, BORDER_TOP_BOTTOM,
pick,
} from '../utils'; } from '../utils';
import { scrollLeftTo, scrollTopTo } from './utils'; import { scrollLeftTo, scrollTopTo } from './utils';
@ -61,37 +63,25 @@ const props = {
color: String, color: String,
border: Boolean, border: Boolean,
sticky: Boolean, sticky: Boolean,
active: makeNumericProp(0),
duration: makeNumericProp(0.3),
animated: Boolean, animated: Boolean,
ellipsis: truthProp, ellipsis: truthProp,
swipeable: Boolean, swipeable: Boolean,
scrollspy: Boolean, scrollspy: Boolean,
offsetTop: makeNumericProp(0),
background: String, background: String,
lazyRender: truthProp, lazyRender: truthProp,
lineWidth: [Number, String], lineWidth: numericProp,
lineHeight: [Number, String], lineHeight: numericProp,
beforeChange: Function as PropType<Interceptor>, beforeChange: Function as PropType<Interceptor>,
swipeThreshold: makeNumericProp(5),
titleActiveColor: String, titleActiveColor: String,
titleInactiveColor: String, titleInactiveColor: String,
type: { type: {
type: String as PropType<TabsType>, type: String as PropType<TabsType>,
default: 'line', default: 'line',
}, },
active: {
type: [Number, String],
default: 0,
},
duration: {
type: [Number, String],
default: 0.3,
},
offsetTop: {
type: [Number, String],
default: 0,
},
swipeThreshold: {
type: [Number, String],
default: 5,
},
}; };
export type TabsProps = ExtractPropTypes<typeof props>; export type TabsProps = ExtractPropTypes<typeof props>;

View File

@ -1,5 +1,5 @@
import { ref, watch, onMounted, defineComponent } from 'vue'; import { ref, watch, onMounted, defineComponent } from 'vue';
import { createNamespace } from '../utils'; import { numericProp, createNamespace } from '../utils';
import { Swipe, SwipeInstance } from '../swipe'; import { Swipe, SwipeInstance } from '../swipe';
const [name, bem] = createNamespace('tabs'); const [name, bem] = createNamespace('tabs');
@ -17,7 +17,7 @@ export default defineComponent({
required: true, required: true,
}, },
duration: { duration: {
type: [Number, String], type: numericProp,
required: true, required: true,
}, },
currentIndex: { currentIndex: {

View File

@ -1,5 +1,5 @@
import { computed, CSSProperties, defineComponent } from 'vue'; import { computed, CSSProperties, defineComponent } from 'vue';
import { createNamespace, isDef, truthProp } from '../utils'; import { isDef, truthProp, numericProp, createNamespace } from '../utils';
import { Badge } from '../badge'; import { Badge } from '../badge';
const [name, bem] = createNamespace('tab'); const [name, bem] = createNamespace('tab');
@ -12,7 +12,7 @@ export default defineComponent({
type: String, type: String,
color: String, color: String,
title: String, title: String,
badge: [Number, String], badge: numericProp,
isActive: Boolean, isActive: Boolean,
disabled: Boolean, disabled: Boolean,
scrollable: Boolean, scrollable: Boolean,

View File

@ -8,7 +8,7 @@ import {
} from 'vue'; } from 'vue';
// Utils // Utils
import { createNamespace, isDef, unknownProp } from '../utils'; import { isDef, unknownProp, numericProp, createNamespace } from '../utils';
import { lockClick } from './lock-click'; import { lockClick } from './lock-click';
// Components // Components
@ -28,8 +28,8 @@ export default defineComponent({
icon: String, icon: String,
show: Boolean, show: Boolean,
overlay: Boolean, overlay: Boolean,
message: [Number, String], message: numericProp,
iconSize: [Number, String], iconSize: numericProp,
className: unknownProp, className: unknownProp,
iconPrefix: String, iconPrefix: String,
loadingType: String as PropType<LoadingType>, loadingType: String as PropType<LoadingType>,

View File

@ -1,7 +1,7 @@
import { PropType, defineComponent } from 'vue'; import { PropType, defineComponent } from 'vue';
// Utils // Utils
import { createNamespace, addUnit } from '../utils'; import { addUnit, createNamespace, makeNumericProp } from '../utils';
// Components // Components
import { Icon } from '../icon'; import { Icon } from '../icon';
@ -29,18 +29,13 @@ export default defineComponent({
name, name,
props: { props: {
max: { max: makeNumericProp(Infinity),
type: [Number, String], height: makeNumericProp(300),
default: Infinity, mainActiveIndex: makeNumericProp(0),
},
items: { items: {
type: Array as PropType<TreeSelectItem[]>, type: Array as PropType<TreeSelectItem[]>,
default: () => [], default: () => [],
}, },
height: {
type: [Number, String],
default: 300,
},
activeId: { activeId: {
type: [Number, String, Array] as PropType< type: [Number, String, Array] as PropType<
number | string | Array<number | string> number | string | Array<number | string>
@ -51,10 +46,6 @@ export default defineComponent({
type: String, type: String,
default: 'success', default: 'success',
}, },
mainActiveIndex: {
type: [Number, String],
default: 0,
},
}, },
emits: [ emits: [

View File

@ -12,8 +12,10 @@ import {
extend, extend,
isPromise, isPromise,
truthProp, truthProp,
numericProp,
Interceptor, Interceptor,
getSizeStyle, getSizeStyle,
makeNumericProp,
ComponentInstance, ComponentInstance,
} from '../utils'; } from '../utils';
import { import {
@ -47,25 +49,23 @@ import type {
} from './types'; } from './types';
const props = { const props = {
name: makeNumericProp(''),
capture: String, capture: String,
multiple: Boolean, multiple: Boolean,
disabled: Boolean, disabled: Boolean,
readonly: Boolean, readonly: Boolean,
lazyLoad: Boolean, lazyLoad: Boolean,
maxCount: makeNumericProp(Number.MAX_VALUE),
uploadText: String, uploadText: String,
deletable: truthProp, deletable: truthProp,
afterRead: Function as PropType<UploaderAfterRead>, afterRead: Function as PropType<UploaderAfterRead>,
showUpload: truthProp, showUpload: truthProp,
beforeRead: Function as PropType<UploaderBeforeRead>, beforeRead: Function as PropType<UploaderBeforeRead>,
beforeDelete: Function as PropType<Interceptor>, beforeDelete: Function as PropType<Interceptor>,
previewSize: [Number, String], previewSize: numericProp,
previewImage: truthProp, previewImage: truthProp,
previewOptions: Object as PropType<ImagePreviewOptions>, previewOptions: Object as PropType<ImagePreviewOptions>,
previewFullImage: truthProp, previewFullImage: truthProp,
name: {
type: [Number, String],
default: '',
},
accept: { accept: {
type: String, type: String,
default: 'image/*', default: 'image/*',
@ -78,10 +78,6 @@ const props = {
type: [Number, String, Function] as PropType<UploaderMaxSize>, type: [Number, String, Function] as PropType<UploaderMaxSize>,
default: Number.MAX_VALUE, default: Number.MAX_VALUE,
}, },
maxCount: {
type: [Number, String],
default: Number.MAX_VALUE,
},
imageFit: { imageFit: {
type: String as PropType<ImageFit>, type: String as PropType<ImageFit>,
default: 'cover', default: 'cover',

View File

@ -6,6 +6,7 @@ import {
isDef, isDef,
extend, extend,
Interceptor, Interceptor,
numericProp,
getSizeStyle, getSizeStyle,
callInterceptor, callInterceptor,
} from '../utils'; } from '../utils';
@ -20,12 +21,12 @@ import type { UploaderFileListItem } from './types';
export default defineComponent({ export default defineComponent({
props: { props: {
name: [Number, String], name: numericProp,
index: Number, index: Number,
imageFit: String as PropType<ImageFit>, imageFit: String as PropType<ImageFit>,
lazyLoad: Boolean, lazyLoad: Boolean,
deletable: Boolean, deletable: Boolean,
previewSize: [Number, String], previewSize: numericProp,
beforeDelete: Function as PropType<Interceptor>, beforeDelete: Function as PropType<Interceptor>,
item: { item: {
type: Object as PropType<UploaderFileListItem>, type: Object as PropType<UploaderFileListItem>,

View File

@ -6,12 +6,18 @@ export const extend = Object.assign;
export const inBrowser = typeof window !== 'undefined'; export const inBrowser = typeof window !== 'undefined';
// PropTypes // propType helpers
// help us to write less code, reduce bundle size
export const unknownProp = null as unknown as PropType<unknown>; export const unknownProp = null as unknown as PropType<unknown>;
export const numericProp = [Number, String];
export const truthProp = { export const truthProp = {
type: Boolean, type: Boolean,
default: true as const, default: true as const,
}; };
export const makeNumericProp = <T>(defaultVal: T) => ({
type: [Number, String],
default: defaultVal,
});
// eslint-disable-next-line // eslint-disable-next-line
export type ComponentInstance = ComponentPublicInstance<{}, any>; export type ComponentInstance = ComponentPublicInstance<{}, any>;