diff --git a/src/action-sheet/index.tsx b/src/action-sheet/index.tsx index bd96a3964..11d2e4d45 100644 --- a/src/action-sheet/index.tsx +++ b/src/action-sheet/index.tsx @@ -51,9 +51,7 @@ export default createComponent({ emits: ['select', 'cancel', 'update:show'], setup(props, { slots, emit }) { - const onUpdateShow = (show: boolean) => { - emit('update:show', show); - }; + const onUpdateShow = (show: boolean) => emit('update:show', show); const onCancel = () => { onUpdateShow(false); diff --git a/src/address-edit/Detail.tsx b/src/address-edit/Detail.tsx index 40b2193b8..b882d0170 100644 --- a/src/address-edit/Detail.tsx +++ b/src/address-edit/Detail.tsx @@ -83,24 +83,14 @@ export default createComponent({ label={express.address} class={bem('search-item')} border={false} - onClick={() => { - onSelect(express); - }} + onClick={() => onSelect(express)} /> )); }; - const onFocus = (event: Event) => { - emit('focus', event); - }; - - const onBlur = (event: Event) => { - emit('blur', event); - }; - - const onInput = (value: string) => { - emit('input', value); - }; + const onBlur = (event: Event) => emit('blur', event); + const onFocus = (event: Event) => emit('focus', event); + const onInput = (value: string) => emit('input', value); return () => { if (props.show) { diff --git a/src/address-edit/index.tsx b/src/address-edit/index.tsx index deecf2532..c73637a6e 100644 --- a/src/address-edit/index.tsx +++ b/src/address-edit/index.tsx @@ -239,12 +239,8 @@ export default createComponent({ Dialog.confirm({ title: t('confirmDelete'), }) - .then(() => { - emit('delete', state.data); - }) - .catch(() => { - emit('cancel-delete', state.data); - }); + .then(() => emit('delete', state.data)) + .catch(() => emit('cancel-delete', state.data)); }; // get values of area component @@ -277,9 +273,7 @@ export default createComponent({ { - emit('change-default', event); - }} + onChange={(event) => emit('change-default', event)} /> ), }; @@ -306,9 +300,7 @@ export default createComponent({ watch( () => props.areaList, - () => { - setAreaCode(state.data.areaCode); - } + () => setAreaCode(state.data.areaCode) ); watch( @@ -378,9 +370,7 @@ export default createComponent({ onBlur={onDetailBlur} onFocus={() => onFocus('addressDetail')} onInput={onChangeDetail} - onSelect-search={(event: Event) => { - emit('select-search', event); - }} + onSelect-search={(event: Event) => emit('select-search', event)} /> {props.showPostal && ( { - emit('click-item', item, index); - }; + const onClick = () => emit('click-item', item, index); const onSelect = () => { const name = disabled ? 'select-disabled' : 'select'; @@ -87,24 +85,18 @@ export default createComponent({ } }; - const renderBottom = () => { - const onClick = () => { - emit('add'); - }; - - return ( -
-
- ); - }; + const renderBottom = () => ( +
+
+ ); return () => { const List = renderList(props.list); diff --git a/src/area/index.tsx b/src/area/index.tsx index 5d121702f..a35953e39 100644 --- a/src/area/index.tsx +++ b/src/area/index.tsx @@ -294,9 +294,7 @@ export default createComponent({ watch( () => props.columnsNum, - () => { - nextTick(setValues); - } + () => nextTick(setValues) ); useExpose({ reset, getArea, getValues }); diff --git a/src/calendar/components/Month.tsx b/src/calendar/components/Month.tsx index 06ab35f3a..e8fc4dea9 100644 --- a/src/calendar/components/Month.tsx +++ b/src/calendar/components/Month.tsx @@ -237,9 +237,7 @@ export default createComponent({ color={props.color} offset={offset.value} rowHeight={rowHeight.value} - onClick={(item) => { - emit('click', item); - }} + onClick={(item) => emit('click', item)} /> ); diff --git a/src/calendar/index.tsx b/src/calendar/index.tsx index 43b5ce5dc..d76e81371 100644 --- a/src/calendar/index.tsx +++ b/src/calendar/index.tsx @@ -332,9 +332,7 @@ export default createComponent({ return true; }; - const onConfirm = () => { - emit('confirm', copyDates(state.currentDate)); - }; + const onConfirm = () => emit('confirm', copyDates(state.currentDate)); const select = (date: Date | Date[], complete?: boolean) => { const setCurrentDate = (date: Date | Date[]) => { @@ -426,9 +424,7 @@ export default createComponent({ } }; - const togglePopup = (value: boolean) => { - emit('update:show', value); - }; + const togglePopup = (value: boolean) => emit('update:show', value); const renderMonth = (date: Date, index: number) => { const showMonthTitle = index !== 0 || !props.showSubtitle; diff --git a/src/card/index.tsx b/src/card/index.tsx index 6a1d86d9e..28f851f20 100644 --- a/src/card/index.tsx +++ b/src/card/index.tsx @@ -80,9 +80,7 @@ export default createComponent({ { - emit('click-thumb', event); - }} + onClick={(event: MouseEvent) => emit('click-thumb', event)} > {renderThumbImage()} {renderThumbTag()} diff --git a/src/cascader/index.tsx b/src/cascader/index.tsx index b11378888..547dd9abb 100644 --- a/src/cascader/index.tsx +++ b/src/cascader/index.tsx @@ -172,9 +172,7 @@ export default createComponent({ } }; - const onClose = () => { - emit('close'); - }; + const onClose = () => emit('close'); const renderHeader = () => (
@@ -200,9 +198,7 @@ export default createComponent({
  • { - onSelect(option, tabIndex); - }} + onClick={() => onSelect(option, tabIndex)} > {option[textKey]} {isSelected ? ( diff --git a/src/checkbox-group/index.tsx b/src/checkbox-group/index.tsx index 9c5afd285..40d31acef 100644 --- a/src/checkbox-group/index.tsx +++ b/src/checkbox-group/index.tsx @@ -69,9 +69,7 @@ export default createComponent({ watch( () => props.modelValue, - (value) => { - emit('change', value); - } + (value) => emit('change', value) ); useExpose({ toggleAll }); diff --git a/src/checkbox/index.tsx b/src/checkbox/index.tsx index c40ced507..0addf1762 100644 --- a/src/checkbox/index.tsx +++ b/src/checkbox/index.tsx @@ -67,9 +67,7 @@ export default createComponent({ watch( () => props.modelValue, - (value) => { - emit('change', value); - } + (value) => emit('change', value) ); useExpose({ toggle, props, checked }); diff --git a/src/contact-edit/index.tsx b/src/contact-edit/index.tsx index cc5e7632b..62fb15ef4 100644 --- a/src/contact-edit/index.tsx +++ b/src/contact-edit/index.tsx @@ -59,9 +59,7 @@ export default createComponent({ const onDelete = () => { Dialog.confirm({ title: t('confirmDelete'), - }).then(() => { - emit('delete', contact); - }); + }).then(() => emit('delete', contact)); }; const renderButtons = () => ( @@ -90,9 +88,7 @@ export default createComponent({ { - emit('change-default', checked); - }} + onChange={(checked: boolean) => emit('change-default', checked)} /> ); diff --git a/src/contact-list/index.tsx b/src/contact-list/index.tsx index 5d5642773..2b0abf368 100644 --- a/src/contact-list/index.tsx +++ b/src/contact-list/index.tsx @@ -96,9 +96,7 @@ export default createComponent({ type="danger" class={bem('add')} text={props.addText || t('addText')} - onClick={() => { - emit('add'); - }} + onClick={() => emit('add')} />
  • diff --git a/src/coupon-list/index.tsx b/src/coupon-list/index.tsx index 1e096592e..3c1438ed9 100644 --- a/src/coupon-list/index.tsx +++ b/src/coupon-list/index.tsx @@ -207,9 +207,7 @@ export default createComponent({ watch( () => state.code, - (value) => { - emit('update:code', value); - } + (value) => emit('update:code', value) ); watch(() => props.displayedCouponIndex, scrollToCoupon); @@ -233,9 +231,7 @@ export default createComponent({ type="danger" class={bem('close')} text={props.closeButtonText || t('close')} - onClick={() => { - emit('change', -1); - }} + onClick={() => emit('change', -1)} /> diff --git a/src/datetime-picker/DatePicker.tsx b/src/datetime-picker/DatePicker.tsx index e1c38246f..d45f707e4 100644 --- a/src/datetime-picker/DatePicker.tsx +++ b/src/datetime-picker/DatePicker.tsx @@ -60,7 +60,7 @@ export default createComponent({ ); return new Date(timestamp); } - + return undefined; }; @@ -270,16 +270,12 @@ export default createComponent({ emit('confirm', currentDate.value); }; - const onCancel = () => { - emit('cancel'); - }; + const onCancel = () => emit('cancel'); const onChange = () => { updateInnerValue(); nextTick(() => { - nextTick(() => { - emit('change', currentDate.value); - }); + nextTick(() => emit('change', currentDate.value)); }); }; @@ -290,9 +286,9 @@ export default createComponent({ watch(columns, updateColumnValue); - watch(currentDate, (value, oldValue) => { - emit('update:modelValue', oldValue ? value : null); - }); + watch(currentDate, (value, oldValue) => + emit('update:modelValue', oldValue ? value : null) + ); watch( [() => props.filter, () => props.minDate, () => props.maxDate], diff --git a/src/datetime-picker/TimePicker.tsx b/src/datetime-picker/TimePicker.tsx index 880b8e9a2..977a24caa 100644 --- a/src/datetime-picker/TimePicker.tsx +++ b/src/datetime-picker/TimePicker.tsx @@ -119,21 +119,13 @@ export default createComponent({ updateColumnValue(); }; - const onConfirm = () => { - emit('confirm', currentDate.value); - }; - - const onCancel = () => { - emit('cancel'); - }; + const onConfirm = () => emit('confirm', currentDate.value); + const onCancel = () => emit('cancel'); const onChange = () => { updateInnerValue(); - nextTick(() => { - nextTick(() => { - emit('change', currentDate.value); - }); + nextTick(() => emit('change', currentDate.value)); }); }; @@ -155,9 +147,7 @@ export default createComponent({ updateInnerValue ); - watch(currentDate, (value) => { - emit('update:modelValue', value); - }); + watch(currentDate, (value) => emit('update:modelValue', value)); watch( () => props.modelValue, diff --git a/src/dialog/Dialog.tsx b/src/dialog/Dialog.tsx index 8239801f4..6c00dc88c 100644 --- a/src/dialog/Dialog.tsx +++ b/src/dialog/Dialog.tsx @@ -64,9 +64,7 @@ export default createComponent({ cancel: false, }); - const onUpdateShow = (value: boolean) => { - emit('update:show', value); - }; + const onUpdateShow = (value: boolean) => emit('update:show', value); const close = (action: DialogAction) => { onUpdateShow(false); diff --git a/src/dropdown-item/index.tsx b/src/dropdown-item/index.tsx index b25c6138b..439344c56 100644 --- a/src/dropdown-item/index.tsx +++ b/src/dropdown-item/index.tsx @@ -64,11 +64,10 @@ export default createComponent({ return; } - const createEmitter = (eventName: 'open' | 'close' | 'opened') => () => - emit(eventName); - const onOpen = createEmitter('open'); - const onClose = createEmitter('close'); - const onOpened = createEmitter('opened'); + const getEmitter = (name: 'open' | 'close' | 'opened') => () => emit(name); + const onOpen = getEmitter('open'); + const onClose = getEmitter('close'); + const onOpened = getEmitter('opened'); const onClosed = () => { state.showWrapper = false; diff --git a/src/field/index.tsx b/src/field/index.tsx index 0cdc6be3e..3863823b9 100644 --- a/src/field/index.tsx +++ b/src/field/index.tsx @@ -330,17 +330,13 @@ export default createComponent({ resetScroll(); }; - const onClickInput = (event: MouseEvent) => { - emit('click-input', event); - }; + const onClickInput = (event: MouseEvent) => emit('click-input', event); - const onClickLeftIcon = (event: MouseEvent) => { + const onClickLeftIcon = (event: MouseEvent) => emit('click-left-icon', event); - }; - const onClickRightIcon = (event: MouseEvent) => { + const onClickRightIcon = (event: MouseEvent) => emit('click-right-icon', event); - }; const onClear = (event: MouseEvent) => { preventDefault(event); diff --git a/src/form/index.tsx b/src/form/index.tsx index 3e979040b..faddb6335 100644 --- a/src/form/index.tsx +++ b/src/form/index.tsx @@ -156,9 +156,7 @@ export default createComponent({ const values = getValues(); validate() - .then(() => { - emit('submit', values); - }) + .then(() => emit('submit', values)) .catch((errors: FieldValidateError[]) => { emit('failed', { values, errors }); diff --git a/src/image-preview/ImagePreview.tsx b/src/image-preview/ImagePreview.tsx index 88b159255..018b290a7 100644 --- a/src/image-preview/ImagePreview.tsx +++ b/src/image-preview/ImagePreview.tsx @@ -16,6 +16,11 @@ import ImagePreviewItem from './ImagePreviewItem'; const [createComponent, bem] = createNamespace('image-preview'); +export type ImagePreviewScaleEventParams = { + scale: number; + index: number; +}; + export default createComponent({ props: { show: Boolean, @@ -90,21 +95,16 @@ export default createComponent({ } }; - const emitScale = (args: { scale: number; index: number }) => { + const emitScale = (args: ImagePreviewScaleEventParams) => emit('scale', args); - }; - const toggle = (show: boolean) => { - emit('update:show', show); - }; + const toggle = (show: boolean) => emit('update:show', show); const emitClose = () => { callInterceptor({ interceptor: props.beforeClose, args: [state.active], - done: () => { - toggle(false); - }, + done: () => toggle(false), }); }; @@ -174,9 +174,7 @@ export default createComponent({ } }; - const onClosed = () => { - emit('closed'); - }; + const onClosed = () => emit('closed'); const swipeTo = (index: number, options?: SwipeToOptions) => { if (swipeRef.value) { diff --git a/src/index-bar/index.tsx b/src/index-bar/index.tsx index 0c6b3f53d..5ca1b0567 100644 --- a/src/index-bar/index.tsx +++ b/src/index-bar/index.tsx @@ -173,9 +173,7 @@ export default createComponent({ } }; - const init = () => { - nextTick(onScroll); - }; + const init = () => nextTick(onScroll); useEventListener('scroll', onScroll, { target: scrollParent }); diff --git a/src/nav-bar/index.tsx b/src/nav-bar/index.tsx index 6168e1166..786533b5c 100644 --- a/src/nav-bar/index.tsx +++ b/src/nav-bar/index.tsx @@ -34,13 +34,8 @@ export default createComponent({ const navBarRef = ref(); const renderPlaceholder = usePlaceholder(navBarRef, bem); - const onClickLeft = (event: MouseEvent) => { - emit('click-left', event); - }; - - const onClickRight = (event: MouseEvent) => { - emit('click-right', event); - }; + const onClickLeft = (event: MouseEvent) => emit('click-left', event); + const onClickRight = (event: MouseEvent) => emit('click-right', event); const renderLeft = () => { if (slots.left) { diff --git a/src/number-keyboard/index.tsx b/src/number-keyboard/index.tsx index 6c950bed3..29e8982bd 100644 --- a/src/number-keyboard/index.tsx +++ b/src/number-keyboard/index.tsx @@ -146,9 +146,7 @@ export default createComponent({ } }; - const onAnimationEnd = () => { - emit(props.show ? 'show' : 'hide'); - }; + const onAnimationEnd = () => emit(props.show ? 'show' : 'hide'); const onPress = (text: string, type: KeyType) => { if (text === '') { diff --git a/src/pagination/index.tsx b/src/pagination/index.tsx index d74543827..26c1634ac 100644 --- a/src/pagination/index.tsx +++ b/src/pagination/index.tsx @@ -144,9 +144,7 @@ export default createComponent({ const value = props.modelValue; const simple = props.mode !== 'multi'; - const onSelect = (value: number) => () => { - select(value, true); - }; + const onSelect = (value: number) => () => select(value, true); return (
      diff --git a/src/picker/PickerColumn.tsx b/src/picker/PickerColumn.tsx index 1f16e980f..c69713891 100644 --- a/src/picker/PickerColumn.tsx +++ b/src/picker/PickerColumn.tsx @@ -289,9 +289,7 @@ export default createComponent({ disabled, selected: index === state.index, }), - onClick: () => { - onClickItem(index); - }, + onClick: () => onClickItem(index), }; const childData = { diff --git a/src/picker/index.tsx b/src/picker/index.tsx index 719f3a42d..4070564ba 100644 --- a/src/picker/index.tsx +++ b/src/picker/index.tsx @@ -286,9 +286,7 @@ export default createComponent({ emitAction('confirm'); }; - const cancel = () => { - emitAction('cancel'); - }; + const cancel = () => emitAction('cancel'); const renderTitle = () => { if (slots.title) { @@ -342,9 +340,7 @@ export default createComponent({ swipeDuration={props.swipeDuration} initialOptions={item[valuesKey]} visibleItemCount={props.visibleItemCount} - onChange={() => { - onChange(columnIndex); - }} + onChange={() => onChange(columnIndex)} /> )); diff --git a/src/popover/index.tsx b/src/popover/index.tsx index a3e6e64ce..2d6535cc7 100644 --- a/src/popover/index.tsx +++ b/src/popover/index.tsx @@ -125,9 +125,7 @@ export default createComponent({ }); }; - const toggle = (value: boolean) => { - emit('update:show', value); - }; + const toggle = (value: boolean) => emit('update:show', value); const onClickWrapper = () => { if (props.trigger === 'click') { @@ -152,9 +150,7 @@ export default createComponent({ } }; - const onClickAway = () => { - toggle(false); - }; + const onClickAway = () => toggle(false); const renderAction = (action: PopoverAction, index: number) => { const { icon, text, color, disabled, className } = action; diff --git a/src/pull-refresh/index.tsx b/src/pull-refresh/index.tsx index de96ac8f5..ff125bb7c 100644 --- a/src/pull-refresh/index.tsx +++ b/src/pull-refresh/index.tsx @@ -179,9 +179,7 @@ export default createComponent({ emit('update:modelValue', true); // ensure value change can be watched - nextTick(() => { - emit('refresh'); - }); + nextTick(() => emit('refresh')); } else { setStatus(0); } diff --git a/src/radio-group/index.tsx b/src/radio-group/index.tsx index 59e9886f3..d5185b625 100644 --- a/src/radio-group/index.tsx +++ b/src/radio-group/index.tsx @@ -29,15 +29,12 @@ export default createComponent({ setup(props, { emit, slots }) { const { linkChildren } = useChildren(RADIO_KEY); - const updateModelValue = (value: unknown) => { + const updateModelValue = (value: unknown) => emit('update:modelValue', value); - }; watch( () => props.modelValue, - (value) => { - emit('change', value); - } + (value) => emit('change', value) ); linkChildren({ diff --git a/src/search/index.tsx b/src/search/index.tsx index 01dcf6a4a..5ef2d6b3d 100644 --- a/src/search/index.tsx +++ b/src/search/index.tsx @@ -120,9 +120,7 @@ export default createComponent({ class: null, }; - const onInput = (value: string) => { - emit('update:modelValue', value); - }; + const onInput = (value: string) => emit('update:modelValue', value); return ( { - emit('update:show', value); - }; + const toggle = (value: boolean) => emit('update:show', value); const onCancel = () => { toggle(false); emit('cancel'); }; - const onSelect = (option: ShareSheetOption, index: number) => { + const onSelect = (option: ShareSheetOption, index: number) => emit('select', option, index); - }; const renderHeader = () => { const title = slots.title ? slots.title() : props.title; @@ -103,9 +100,7 @@ export default createComponent({ role="button" tabindex={0} class={[bem('option'), className]} - onClick={() => { - onSelect(option, index); - }} + onClick={() => onSelect(option, index)} > {name && {name}} diff --git a/src/step/index.tsx b/src/step/index.tsx index 7e12d3a22..ebca48e73 100644 --- a/src/step/index.tsx +++ b/src/step/index.tsx @@ -52,9 +52,7 @@ export default createComponent({ } }); - const onClickStep = () => { - parent.onClickStep(index.value); - }; + const onClickStep = () => parent.onClickStep(index.value); const renderCircle = () => { const { finishIcon, activeIcon, activeColor, inactiveIcon } = parentProps; diff --git a/src/steps/index.tsx b/src/steps/index.tsx index 7180d7d5d..0d35e88d5 100644 --- a/src/steps/index.tsx +++ b/src/steps/index.tsx @@ -46,9 +46,7 @@ export default createComponent({ setup(props, { emit, slots }) { const { linkChildren } = useChildren(STEPS_KEY); - const onClickStep = (index: number) => { - emit('click-step', index); - }; + const onClickStep = (index: number) => emit('click-step', index); linkChildren({ props, diff --git a/src/submit-bar/index.tsx b/src/submit-bar/index.tsx index 966053125..97360d1cb 100644 --- a/src/submit-bar/index.tsx +++ b/src/submit-bar/index.tsx @@ -83,9 +83,7 @@ export default createComponent({ } }; - const onClickButton = () => { - emit('submit'); - }; + const onClickButton = () => emit('submit'); const renderButton = () => { if (slots.button) { diff --git a/src/swipe-cell/index.tsx b/src/swipe-cell/index.tsx index e97481ac5..f3e00f13d 100644 --- a/src/swipe-cell/index.tsx +++ b/src/swipe-cell/index.tsx @@ -147,9 +147,7 @@ export default createComponent({ position, }, ], - done: () => { - close(position); - }, + done: () => close(position), }); } }; @@ -186,13 +184,7 @@ export default createComponent({ close, }); - useClickAway( - root, - () => { - onClick('outside'); - }, - { eventName: 'touchstart' } - ); + useClickAway(root, () => onClick('outside'), { eventName: 'touchstart' }); return () => { const wrapperStyle = { diff --git a/src/swipe/index.tsx b/src/swipe/index.tsx index 1df9a0296..e78016dc0 100644 --- a/src/swipe/index.tsx +++ b/src/swipe/index.tsx @@ -297,9 +297,7 @@ export default createComponent({ autoplay(); }; - const resize = () => { - initialize(state.active); - }; + const resize = () => initialize(state.active); let touchStartTime: number; @@ -454,9 +452,7 @@ export default createComponent({ }); onMounted(initialize); - onActivated(() => { - initialize(state.active); - }); + onActivated(() => initialize(state.active)); onDeactivated(stopAutoplay); onBeforeUnmount(stopAutoplay); diff --git a/src/tabs/TabsContent.tsx b/src/tabs/TabsContent.tsx index 6699dbd1f..3781480ce 100644 --- a/src/tabs/TabsContent.tsx +++ b/src/tabs/TabsContent.tsx @@ -29,9 +29,7 @@ export default createComponent({ setup(props, { emit, slots }) { const swipeRef = ref(); - const onChange = (index: number) => { - emit('change', index); - }; + const onChange = (index: number) => emit('change', index); const renderChildren = () => { const Content = slots.default?.(); diff --git a/src/tabs/index.tsx b/src/tabs/index.tsx index 88e01f285..37f7578d8 100644 --- a/src/tabs/index.tsx +++ b/src/tabs/index.tsx @@ -438,9 +438,8 @@ export default createComponent({ }); }; - const onRendered = (name: string | number, title?: string) => { + const onRendered = (name: string | number, title?: string) => emit('rendered', name, title); - }; useExpose({ resize: setLine, diff --git a/src/toast/Toast.tsx b/src/toast/Toast.tsx index e2164f02a..801662428 100644 --- a/src/toast/Toast.tsx +++ b/src/toast/Toast.tsx @@ -70,9 +70,7 @@ export default createComponent({ clearTimeout(timer); }; - const toggle = (show: boolean) => { - emit('update:show', show); - }; + const toggle = (show: boolean) => emit('update:show', show); const renderIcon = () => { const { icon, type, iconPrefix, loadingType } = props; diff --git a/src/uploader/PreviewItem.tsx b/src/uploader/PreviewItem.tsx index dd69d59de..0b9371fdb 100644 --- a/src/uploader/PreviewItem.tsx +++ b/src/uploader/PreviewItem.tsx @@ -56,15 +56,11 @@ export default defineComponent({ callInterceptor({ interceptor: beforeDelete, args: [item, { name, index }], - done() { - emit('delete'); - }, + done: () => emit('delete'), }); }; - const onPreview = () => { - emit('preview'); - }; + const onPreview = () => emit('preview'); const renderDeleteIcon = () => { if (props.deletable && props.item.status !== 'uploading') { diff --git a/src/uploader/index.tsx b/src/uploader/index.tsx index 737482f6a..a1f63c1b1 100644 --- a/src/uploader/index.tsx +++ b/src/uploader/index.tsx @@ -233,9 +233,7 @@ export default createComponent({ let imagePreview: ComponentInstance | undefined; - const onClosePreview = () => { - emit('close-preview'); - }; + const onClosePreview = () => emit('close-preview'); const previewImage = (item: FileListItem) => { if (props.previewFullImage) { @@ -285,15 +283,9 @@ export default createComponent({ v-slots={{ 'preview-cover': slots['preview-cover'] }} item={item} index={index} - onClick={() => { - emit('click-preview', item, getDetail(index)); - }} - onDelete={() => { - deleteFile(item, index); - }} - onPreview={() => { - previewImage(item); - }} + onClick={() => emit('click-preview', item, getDetail(index))} + onDelete={() => deleteFile(item, index)} + onPreview={() => previewImage(item)} {...pick(props, ['name', 'lazyLoad'])} {...previewData} />