diff --git a/src/action-bar-button/index.tsx b/src/action-bar-button/index.tsx
index fc3087a32..ca2068e0a 100644
--- a/src/action-bar-button/index.tsx
+++ b/src/action-bar-button/index.tsx
@@ -2,7 +2,7 @@ import { computed, PropType } from 'vue';
import { createNamespace } from '../utils';
import { ACTION_BAR_KEY } from '../action-bar';
-// Composition
+// Composables
import { useParent } from '@vant/use';
import { useExpose } from '../composables/use-expose';
import { useRoute, routeProps } from '../composables/use-route';
diff --git a/src/action-bar-icon/index.tsx b/src/action-bar-icon/index.tsx
index d562ddfcd..e92e8690e 100644
--- a/src/action-bar-icon/index.tsx
+++ b/src/action-bar-icon/index.tsx
@@ -1,7 +1,7 @@
import { createNamespace, UnknownProp } from '../utils';
import { ACTION_BAR_KEY } from '../action-bar';
-// Composition
+// Composables
import { useParent } from '@vant/use';
import { useRoute, routeProps } from '../composables/use-route';
diff --git a/src/action-sheet/index.tsx b/src/action-sheet/index.tsx
index 11d2e4d45..7897b5041 100644
--- a/src/action-sheet/index.tsx
+++ b/src/action-sheet/index.tsx
@@ -51,10 +51,10 @@ export default createComponent({
emits: ['select', 'cancel', 'update:show'],
setup(props, { slots, emit }) {
- const onUpdateShow = (show: boolean) => emit('update:show', show);
+ const updateShow = (show: boolean) => emit('update:show', show);
const onCancel = () => {
- onUpdateShow(false);
+ updateShow(false);
emit('cancel');
};
@@ -118,7 +118,7 @@ export default createComponent({
emit('select', item, index);
if (props.closeOnClickAction) {
- onUpdateShow(false);
+ updateShow(false);
}
};
@@ -157,7 +157,7 @@ export default createComponent({
safeAreaInsetBottom={props.safeAreaInsetBottom}
{...{
...pick(props, popupSharedPropKeys),
- 'onUpdate:show': onUpdateShow,
+ 'onUpdate:show': updateShow,
}}
>
{renderHeader()}
diff --git a/src/address-edit/index.tsx b/src/address-edit/index.tsx
index c73637a6e..19ab25aa8 100644
--- a/src/address-edit/index.tsx
+++ b/src/address-edit/index.tsx
@@ -4,7 +4,7 @@ import { ref, watch, computed, nextTick, reactive, PropType } from 'vue';
import { ComponentInstance, createNamespace, isObject } from '../utils';
import { isMobile } from '../utils/validate/mobile';
-// Composition
+// Composables
import { useExpose } from '../composables/use-expose';
// Components
diff --git a/src/area/index.tsx b/src/area/index.tsx
index a35953e39..afef504fa 100644
--- a/src/area/index.tsx
+++ b/src/area/index.tsx
@@ -13,7 +13,7 @@ import {
import { deepClone } from '../utils/deep-clone';
import { pick, createNamespace, ComponentInstance } from '../utils';
-// Composition
+// Composables
import { useExpose } from '../composables/use-expose';
// Components
diff --git a/src/calendar/components/Month.tsx b/src/calendar/components/Month.tsx
index e8fc4dea9..7e2601722 100644
--- a/src/calendar/components/Month.tsx
+++ b/src/calendar/components/Month.tsx
@@ -12,7 +12,7 @@ import {
formatMonthTitle,
} from '../utils';
-// Composition
+// Composables
import { useToggle } from '@vant/use';
import { useExpose } from '../../composables/use-expose';
import { useHeight } from '../../composables/use-height';
diff --git a/src/calendar/index.tsx b/src/calendar/index.tsx
index d76e81371..0089b7e9a 100644
--- a/src/calendar/index.tsx
+++ b/src/calendar/index.tsx
@@ -17,7 +17,7 @@ import {
getDayByOffset,
} from './utils';
-// Composition
+// Composables
import { raf, useRect, onMountedOrActivated } from '@vant/use';
import { useRefs } from '../composables/use-refs';
import { useExpose } from '../composables/use-expose';
@@ -424,7 +424,7 @@ export default createComponent({
}
};
- const togglePopup = (value: boolean) => emit('update:show', value);
+ const updateShow = (value: boolean) => emit('update:show', value);
const renderMonth = (date: Date, index: number) => {
const showMonthTitle = index !== 0 || !props.showSubtitle;
@@ -533,7 +533,7 @@ export default createComponent({
teleport={props.teleport}
closeOnPopstate={props.closeOnPopstate}
closeOnClickOverlay={props.closeOnClickOverlay}
- {...{ 'onUpdate:show': togglePopup }}
+ {...{ 'onUpdate:show': updateShow }}
>
{renderCalendar()}
diff --git a/src/cell/index.tsx b/src/cell/index.tsx
index c03db1543..f299a2c32 100644
--- a/src/cell/index.tsx
+++ b/src/cell/index.tsx
@@ -3,7 +3,7 @@ import { PropType, CSSProperties } from 'vue';
// Utils
import { createNamespace, isDef, UnknownProp } from '../utils';
-// Composition
+// Composables
import { useRoute, routeProps } from '../composables/use-route';
// Components
diff --git a/src/checkbox-group/index.tsx b/src/checkbox-group/index.tsx
index 40d31acef..057a97dc2 100644
--- a/src/checkbox-group/index.tsx
+++ b/src/checkbox-group/index.tsx
@@ -21,7 +21,7 @@ export type CheckboxGroupProvide = CheckerParent & {
max: number | string;
modelValue: unknown[];
};
- updateModelValue: (value: unknown[]) => void;
+ updateValue: (value: unknown[]) => void;
};
export default createComponent({
@@ -42,9 +42,7 @@ export default createComponent({
setup(props, { emit, slots }) {
const { children, linkChildren } = useChildren(CHECKBOX_GROUP_KEY);
- const updateModelValue = (value: unknown[]) => {
- emit('update:modelValue', value);
- };
+ const updateValue = (value: unknown[]) => emit('update:modelValue', value);
const toggleAll = (options: CheckboxGroupToggleAllOptions = {}) => {
if (typeof options === 'boolean') {
@@ -64,7 +62,7 @@ export default createComponent({
});
const names = checkedChildren.map((item: any) => item.name);
- updateModelValue(names);
+ updateValue(names);
};
watch(
@@ -76,7 +74,7 @@ export default createComponent({
useLinkField(() => props.modelValue);
linkChildren({
props,
- updateModelValue,
+ updateValue,
});
return () =>
{slots.default?.()}
;
diff --git a/src/checkbox/index.tsx b/src/checkbox/index.tsx
index 0addf1762..f63e50ad0 100644
--- a/src/checkbox/index.tsx
+++ b/src/checkbox/index.tsx
@@ -1,10 +1,16 @@
import { computed, watch } from 'vue';
+
+// Utils
import { createNamespace, pick } from '../utils';
+import { CHECKBOX_GROUP_KEY, CheckboxGroupProvide } from '../checkbox-group';
+
+// Composables
import { useParent } from '@vant/use';
import { useExpose } from '../composables/use-expose';
import { useLinkField } from '../composables/use-link-field';
+
+// Components
import Checker, { checkerProps } from './Checker';
-import { CHECKBOX_GROUP_KEY, CheckboxGroupProvide } from '../checkbox-group';
const [createComponent, bem] = createNamespace('checkbox');
@@ -34,7 +40,7 @@ export default createComponent({
value.push(name);
if (props.bindGroup) {
- parent!.updateModelValue(value);
+ parent!.updateValue(value);
}
}
} else {
@@ -44,7 +50,7 @@ export default createComponent({
value.splice(index, 1);
if (props.bindGroup) {
- parent!.updateModelValue(value);
+ parent!.updateValue(value);
}
}
}
diff --git a/src/collapse-item/index.tsx b/src/collapse-item/index.tsx
index a8c72effa..3b35ade9b 100644
--- a/src/collapse-item/index.tsx
+++ b/src/collapse-item/index.tsx
@@ -3,7 +3,7 @@ import { ref, watch, computed, nextTick } from 'vue';
// Utils
import { createNamespace } from '../utils';
-// Composition
+// Composables
import { raf, doubleRaf, useParent } from '@vant/use';
import { useExpose } from '../composables/use-expose';
import { useLazyRender } from '../composables/use-lazy-render';
diff --git a/src/count-down/index.tsx b/src/count-down/index.tsx
index 1e79fda6d..c36e315d2 100644
--- a/src/count-down/index.tsx
+++ b/src/count-down/index.tsx
@@ -4,7 +4,7 @@ import { watch, computed } from 'vue';
import { createNamespace } from '../utils';
import { parseFormat } from './utils';
-// Composition
+// Composables
import { useCountDown } from '@vant/use';
import { useExpose } from '../composables/use-expose';
diff --git a/src/coupon-list/index.tsx b/src/coupon-list/index.tsx
index 3c1438ed9..8d35f81ae 100644
--- a/src/coupon-list/index.tsx
+++ b/src/coupon-list/index.tsx
@@ -3,7 +3,7 @@ import { watch, computed, nextTick, reactive, PropType, onMounted } from 'vue';
// Utils
import { createNamespace } from '../utils';
-// Composition
+// Composables
import { useWindowSize } from '@vant/use';
import { useRefs } from '../composables/use-refs';
diff --git a/src/datetime-picker/DatePicker.tsx b/src/datetime-picker/DatePicker.tsx
index d45f707e4..e9115456c 100644
--- a/src/datetime-picker/DatePicker.tsx
+++ b/src/datetime-picker/DatePicker.tsx
@@ -19,7 +19,7 @@ import {
DatetimePickerType,
} from './utils';
-// Composition
+// Composables
import { useExpose } from '../composables/use-expose';
// Components
diff --git a/src/datetime-picker/TimePicker.tsx b/src/datetime-picker/TimePicker.tsx
index 977a24caa..ddac21448 100644
--- a/src/datetime-picker/TimePicker.tsx
+++ b/src/datetime-picker/TimePicker.tsx
@@ -10,7 +10,7 @@ import {
} from '../utils';
import { times, sharedProps, pickerKeys } from './utils';
-// Composition
+// Composables
import { useExpose } from '../composables/use-expose';
// Components
diff --git a/src/dialog/Dialog.tsx b/src/dialog/Dialog.tsx
index 6c00dc88c..46b961fae 100644
--- a/src/dialog/Dialog.tsx
+++ b/src/dialog/Dialog.tsx
@@ -64,10 +64,10 @@ export default createComponent({
cancel: false,
});
- const onUpdateShow = (value: boolean) => emit('update:show', value);
+ const updateShow = (value: boolean) => emit('update:show', value);
const close = (action: DialogAction) => {
- onUpdateShow(false);
+ updateShow(false);
if (props.callback) {
props.callback(action);
}
@@ -212,7 +212,7 @@ export default createComponent({
aria-labelledby={title || message}
{...{
...pick(props, popupKeys),
- 'onUpdate:show': onUpdateShow,
+ 'onUpdate:show': updateShow,
}}
>
{renderTitle()}
diff --git a/src/dropdown-item/index.tsx b/src/dropdown-item/index.tsx
index 439344c56..8ef7917f9 100644
--- a/src/dropdown-item/index.tsx
+++ b/src/dropdown-item/index.tsx
@@ -10,7 +10,7 @@ import {
import { createNamespace, UnknownProp } from '../utils';
import { DROPDOWN_KEY, DropdownMenuProvide } from '../dropdown-menu';
-// Composition
+// Composables
import { useParent } from '@vant/use';
import { useExpose } from '../composables/use-expose';
diff --git a/src/dropdown-menu/index.tsx b/src/dropdown-menu/index.tsx
index 74531bb8e..d005bebae 100644
--- a/src/dropdown-menu/index.tsx
+++ b/src/dropdown-menu/index.tsx
@@ -3,7 +3,7 @@ import { ref, computed, PropType, CSSProperties, Ref } from 'vue';
// Utils
import { isDef, ComponentInstance, createNamespace } from '../utils';
-// Composition
+// Composables
import {
useRect,
useChildren,
diff --git a/src/field/index.tsx b/src/field/index.tsx
index 3863823b9..7d66cef70 100644
--- a/src/field/index.tsx
+++ b/src/field/index.tsx
@@ -26,7 +26,7 @@ import {
} from '../utils';
import { runSyncRule } from './utils';
-// Composition
+// Composables
import { useParent } from '@vant/use';
import { useExpose } from '../composables/use-expose';
import { FORM_KEY, FIELD_KEY } from '../composables/use-link-field';
diff --git a/src/form/index.tsx b/src/form/index.tsx
index faddb6335..c022baee0 100644
--- a/src/form/index.tsx
+++ b/src/form/index.tsx
@@ -3,7 +3,7 @@ import { PropType } from 'vue';
// Utils
import { createNamespace, ComponentInstance } from '../utils';
-// Composition
+// Composables
import { useChildren } from '@vant/use';
import { FORM_KEY } from '../composables/use-link-field';
import { useExpose } from '../composables/use-expose';
diff --git a/src/grid-item/index.tsx b/src/grid-item/index.tsx
index 3efdcae32..a47231348 100644
--- a/src/grid-item/index.tsx
+++ b/src/grid-item/index.tsx
@@ -5,7 +5,7 @@ import { createNamespace, addUnit } from '../utils';
import { BORDER } from '../utils/constant';
import { GRID_KEY, GridProvide } from '../grid';
-// Composition
+// Composables
import { useParent } from '@vant/use';
import { useRoute, routeProps } from '../composables/use-route';
diff --git a/src/image-preview/ImagePreview.tsx b/src/image-preview/ImagePreview.tsx
index 018b290a7..145ea9ced 100644
--- a/src/image-preview/ImagePreview.tsx
+++ b/src/image-preview/ImagePreview.tsx
@@ -1,10 +1,10 @@
-import { nextTick, onMounted, PropType, reactive, ref, watch } from 'vue';
+import { ref, watch, nextTick, onMounted, PropType, reactive } from 'vue';
// Utils
import { ComponentInstance, UnknownProp, createNamespace } from '../utils';
import { callInterceptor, Interceptor } from '../utils/interceptor';
-// Composition
+// Composables
import { useWindowSize } from '@vant/use';
import { useExpose } from '../composables/use-expose';
@@ -98,13 +98,13 @@ export default createComponent({
const emitScale = (args: ImagePreviewScaleEventParams) =>
emit('scale', args);
- const toggle = (show: boolean) => emit('update:show', show);
+ const updateShow = (show: boolean) => emit('update:show', show);
const emitClose = () => {
callInterceptor({
interceptor: props.beforeClose,
args: [state.active],
- done: () => toggle(false),
+ done: () => updateShow(false),
});
};
@@ -221,7 +221,7 @@ export default createComponent({
overlayClass={bem('overlay')}
closeOnPopstate={props.closeOnPopstate}
onClosed={onClosed}
- {...{ 'onUpdate:show': toggle }}
+ {...{ 'onUpdate:show': updateShow }}
>
{renderClose()}
{renderImages()}
diff --git a/src/image-preview/ImagePreviewItem.tsx b/src/image-preview/ImagePreviewItem.tsx
index 2b19f9232..8f48ec03b 100644
--- a/src/image-preview/ImagePreviewItem.tsx
+++ b/src/image-preview/ImagePreviewItem.tsx
@@ -3,7 +3,7 @@ import { watch, computed, reactive, CSSProperties, defineComponent } from 'vue';
// Utils
import { range, preventDefault, createNamespace } from '../utils';
-// Composition
+// Composables
import { useTouch } from '../composables/use-touch';
// Component
diff --git a/src/index-anchor/index.tsx b/src/index-anchor/index.tsx
index 5ca88e2cd..54bafda60 100644
--- a/src/index-anchor/index.tsx
+++ b/src/index-anchor/index.tsx
@@ -6,7 +6,7 @@ import { BORDER_BOTTOM } from '../utils/constant';
import { INDEX_BAR_KEY, IndexBarProvide } from '../index-bar';
import { getScrollTop, getRootScrollTop } from '../utils/dom/scroll';
-// Composition
+// Composables
import { useRect, useParent } from '@vant/use';
import { useExpose } from '../composables/use-expose';
diff --git a/src/index-bar/index.tsx b/src/index-bar/index.tsx
index 5ca1b0567..c92dc819d 100644
--- a/src/index-bar/index.tsx
+++ b/src/index-bar/index.tsx
@@ -20,7 +20,7 @@ import {
ComponentInstance,
} from '../utils';
-// Composition
+// Composables
import {
useRect,
useChildren,
diff --git a/src/list/index.tsx b/src/list/index.tsx
index 242889f03..a762a7331 100644
--- a/src/list/index.tsx
+++ b/src/list/index.tsx
@@ -3,7 +3,7 @@ import { ref, watch, nextTick, onUpdated, onMounted, PropType } from 'vue';
// Utils
import { isHidden, createNamespace } from '../utils';
-// Composition
+// Composables
import { useRect, useScrollParent, useEventListener } from '@vant/use';
import { useExpose } from '../composables/use-expose';
diff --git a/src/nav-bar/index.tsx b/src/nav-bar/index.tsx
index 786533b5c..08ef5c7f1 100644
--- a/src/nav-bar/index.tsx
+++ b/src/nav-bar/index.tsx
@@ -4,7 +4,7 @@ import { ref, CSSProperties } from 'vue';
import { createNamespace } from '../utils';
import { BORDER_BOTTOM } from '../utils/constant';
-// Composition
+// Composables
import { usePlaceholder } from '../composables/use-placeholder';
// Components
diff --git a/src/notice-bar/index.tsx b/src/notice-bar/index.tsx
index 38c30067b..7bb21c8cb 100644
--- a/src/notice-bar/index.tsx
+++ b/src/notice-bar/index.tsx
@@ -1,7 +1,7 @@
import { ref, watch, reactive, PropType } from 'vue';
import { isDef, createNamespace } from '../utils';
-// Composition
+// Composables
import {
raf,
useRect,
diff --git a/src/picker/PickerColumn.tsx b/src/picker/PickerColumn.tsx
index c69713891..d22e7441d 100644
--- a/src/picker/PickerColumn.tsx
+++ b/src/picker/PickerColumn.tsx
@@ -11,7 +11,7 @@ import {
createNamespace,
} from '../utils';
-// Composition
+// Composables
import { useParent } from '@vant/use';
import { useTouch } from '../composables/use-touch';
import { useExpose } from '../composables/use-expose';
diff --git a/src/picker/index.tsx b/src/picker/index.tsx
index 4070564ba..6c5997f00 100644
--- a/src/picker/index.tsx
+++ b/src/picker/index.tsx
@@ -9,7 +9,7 @@ import {
} from '../utils';
import { BORDER_UNSET_TOP_BOTTOM } from '../utils/constant';
-// Composition
+// Composables
import { useChildren } from '@vant/use';
import { useExpose } from '../composables/use-expose';
diff --git a/src/popover/index.tsx b/src/popover/index.tsx
index 2d6535cc7..0e1a7b275 100644
--- a/src/popover/index.tsx
+++ b/src/popover/index.tsx
@@ -13,7 +13,7 @@ import { Instance, createPopper, offsetModifier } from '@vant/popperjs';
import { ComponentInstance, createNamespace } from '../utils';
import { BORDER_BOTTOM } from '../utils/constant';
-// Composition
+// Composables
import { useClickAway } from '@vant/use';
// Components
@@ -125,11 +125,11 @@ export default createComponent({
});
};
- const toggle = (value: boolean) => emit('update:show', value);
+ const updateShow = (value: boolean) => emit('update:show', value);
const onClickWrapper = () => {
if (props.trigger === 'click') {
- toggle(!props.show);
+ updateShow(!props.show);
}
};
@@ -146,11 +146,11 @@ export default createComponent({
emit('select', action, index);
if (props.closeOnClickAction) {
- toggle(false);
+ updateShow(false);
}
};
- const onClickAway = () => toggle(false);
+ const onClickAway = () => updateShow(false);
const renderAction = (action: PopoverAction, index: number) => {
const { icon, text, color, disabled, className } = action;
@@ -194,7 +194,7 @@ export default createComponent({
transition="van-popover-zoom"
lockScroll={false}
onTouchstart={onTouchstart}
- {...{ ...attrs, 'onUpdate:show': toggle }}
+ {...{ ...attrs, 'onUpdate:show': updateShow }}
>
diff --git a/src/popup/index.tsx b/src/popup/index.tsx
index 4bf6bb050..c92c50334 100644
--- a/src/popup/index.tsx
+++ b/src/popup/index.tsx
@@ -15,7 +15,7 @@ import {
import { popupSharedProps } from './shared';
import { createNamespace, isDef } from '../utils';
-// Composition
+// Composables
import { useEventListener } from '@vant/use';
import { useExpose } from '../composables/use-expose';
import { useLockScroll } from '../composables/use-lock-scroll';
diff --git a/src/pull-refresh/index.tsx b/src/pull-refresh/index.tsx
index ff125bb7c..24d7b564b 100644
--- a/src/pull-refresh/index.tsx
+++ b/src/pull-refresh/index.tsx
@@ -3,7 +3,7 @@ import { ref, watch, reactive, nextTick } from 'vue';
// Utils
import { preventDefault, getScrollTop, createNamespace } from '../utils';
-// Composition
+// Composables
import { useScrollParent } from '@vant/use';
import { useTouch } from '../composables/use-touch';
diff --git a/src/radio-group/index.tsx b/src/radio-group/index.tsx
index d5185b625..dd6ffc830 100644
--- a/src/radio-group/index.tsx
+++ b/src/radio-group/index.tsx
@@ -12,7 +12,7 @@ export type RadioGroupProvide = CheckerParent & {
props: {
modelValue: unknown;
};
- updateModelValue: (value: unknown) => void;
+ updateValue: (value: unknown) => void;
};
export default createComponent({
@@ -29,8 +29,7 @@ export default createComponent({
setup(props, { emit, slots }) {
const { linkChildren } = useChildren(RADIO_KEY);
- const updateModelValue = (value: unknown) =>
- emit('update:modelValue', value);
+ const updateValue = (value: unknown) => emit('update:modelValue', value);
watch(
() => props.modelValue,
@@ -39,7 +38,7 @@ export default createComponent({
linkChildren({
props,
- updateModelValue,
+ updateValue,
});
useLinkField(() => props.modelValue);
diff --git a/src/radio/index.tsx b/src/radio/index.tsx
index 5b1175d6f..297c78510 100644
--- a/src/radio/index.tsx
+++ b/src/radio/index.tsx
@@ -20,7 +20,7 @@ export default createComponent({
const toggle = () => {
if (parent) {
- parent.updateModelValue(props.name);
+ parent.updateValue(props.name);
} else {
emit('update:modelValue', props.name);
}
diff --git a/src/rate/index.tsx b/src/rate/index.tsx
index cb1364092..90eea1100 100644
--- a/src/rate/index.tsx
+++ b/src/rate/index.tsx
@@ -3,7 +3,7 @@ import { computed } from 'vue';
// Utils
import { addUnit, createNamespace, preventDefault } from '../utils';
-// Composition
+// Composables
import { useRefs } from '../composables/use-refs';
import { useTouch } from '../composables/use-touch';
import { useLinkField } from '../composables/use-link-field';
diff --git a/src/search/index.tsx b/src/search/index.tsx
index 5ef2d6b3d..9ad0a1625 100644
--- a/src/search/index.tsx
+++ b/src/search/index.tsx
@@ -8,7 +8,7 @@ import {
ComponentInstance,
} from '../utils';
-// Composition
+// Composables
import { useExpose } from '../composables/use-expose';
// Components
diff --git a/src/share-sheet/index.tsx b/src/share-sheet/index.tsx
index 3b1c5917a..541063de0 100644
--- a/src/share-sheet/index.tsx
+++ b/src/share-sheet/index.tsx
@@ -65,10 +65,10 @@ export default createComponent({
emits: ['cancel', 'select', 'update:show'],
setup(props, { emit, slots }) {
- const toggle = (value: boolean) => emit('update:show', value);
+ const updateShow = (value: boolean) => emit('update:show', value);
const onCancel = () => {
- toggle(false);
+ updateShow(false);
emit('cancel');
};
@@ -143,7 +143,7 @@ export default createComponent({
position="bottom"
{...{
...pick(props, popupKeys),
- 'onUpdate:show': toggle,
+ 'onUpdate:show': updateShow,
}}
>
{renderHeader()}
diff --git a/src/slider/index.tsx b/src/slider/index.tsx
index d040ed72d..f57d5ab9a 100644
--- a/src/slider/index.tsx
+++ b/src/slider/index.tsx
@@ -9,7 +9,7 @@ import {
createNamespace,
} from '../utils';
-// Composition
+// Composables
import { useRect } from '@vant/use';
import { useTouch } from '../composables/use-touch';
import { useLinkField } from '../composables/use-link-field';
diff --git a/src/step/index.tsx b/src/step/index.tsx
index ebca48e73..a4e582a0b 100644
--- a/src/step/index.tsx
+++ b/src/step/index.tsx
@@ -5,7 +5,7 @@ import { createNamespace } from '../utils';
import { BORDER } from '../utils/constant';
import { STEPS_KEY, StepsProvide } from '../steps';
-// Composition
+// Composables
import { useParent } from '@vant/use';
// Components
diff --git a/src/stepper/index.tsx b/src/stepper/index.tsx
index a9a956c9f..74d84df47 100644
--- a/src/stepper/index.tsx
+++ b/src/stepper/index.tsx
@@ -12,7 +12,7 @@ import {
createNamespace,
} from '../utils';
-// Composition
+// Composables
import { useLinkField } from '../composables/use-link-field';
import { Interceptor, callInterceptor } from '../utils/interceptor';
diff --git a/src/sticky/index.tsx b/src/sticky/index.tsx
index 809898f89..ec912fb48 100644
--- a/src/sticky/index.tsx
+++ b/src/sticky/index.tsx
@@ -3,7 +3,7 @@ import { computed, CSSProperties, PropType, reactive, ref } from 'vue';
// Utils
import { createNamespace, getScrollTop, isHidden, unitToPx } from '../utils';
-// Composition
+// Composables
import { useRect, useEventListener, useScrollParent } from '@vant/use';
import { useVisibilityChange } from '../composables/use-visibility-change';
diff --git a/src/swipe-cell/index.tsx b/src/swipe-cell/index.tsx
index f3e00f13d..991b08eb4 100644
--- a/src/swipe-cell/index.tsx
+++ b/src/swipe-cell/index.tsx
@@ -4,7 +4,7 @@ import { ref, Ref, reactive, computed, PropType } from 'vue';
import { range, isDef, createNamespace, preventDefault } from '../utils';
import { callInterceptor, Interceptor } from '../utils/interceptor';
-// Composition
+// Composables
import { useRect, useClickAway } from '@vant/use';
import { useTouch } from '../composables/use-touch';
import { useExpose } from '../composables/use-expose';
diff --git a/src/swipe/index.tsx b/src/swipe/index.tsx
index e78016dc0..f34a863bf 100644
--- a/src/swipe/index.tsx
+++ b/src/swipe/index.tsx
@@ -20,7 +20,7 @@ import {
ComponentInstance,
} from '../utils';
-// Composition
+// Composables
import {
useRect,
doubleRaf,
diff --git a/src/tab/index.tsx b/src/tab/index.tsx
index be204b8da..25588675e 100644
--- a/src/tab/index.tsx
+++ b/src/tab/index.tsx
@@ -2,7 +2,7 @@ import { ref, watch, nextTick, PropType, CSSProperties } from 'vue';
import { createNamespace, UnknownProp } from '../utils';
import { TABS_KEY, TabsProvide } from '../tabs';
-// Composition
+// Composables
import { useParent } from '@vant/use';
import { routeProps } from '../composables/use-route';
diff --git a/src/tabbar-item/index.tsx b/src/tabbar-item/index.tsx
index 9a8c6a40f..6f8545e4a 100644
--- a/src/tabbar-item/index.tsx
+++ b/src/tabbar-item/index.tsx
@@ -4,7 +4,7 @@ import { TABBAR_KEY, TabbarProvide } from '../tabbar';
// Utils
import { createNamespace, isObject } from '../utils';
-// Composition
+// Composables
import { useParent } from '@vant/use';
import { routeProps, useRoute } from '../composables/use-route';
diff --git a/src/tabbar/index.tsx b/src/tabbar/index.tsx
index 6e7c09063..bf87f0238 100644
--- a/src/tabbar/index.tsx
+++ b/src/tabbar/index.tsx
@@ -5,7 +5,7 @@ import { createNamespace } from '../utils';
import { BORDER_TOP_BOTTOM } from '../utils/constant';
import { callInterceptor, Interceptor } from '../utils/interceptor';
-// Composition
+// Composables
import { useChildren } from '@vant/use';
import { usePlaceholder } from '../composables/use-placeholder';
diff --git a/src/tabs/index.tsx b/src/tabs/index.tsx
index 37f7578d8..5fb394d5b 100644
--- a/src/tabs/index.tsx
+++ b/src/tabs/index.tsx
@@ -28,7 +28,7 @@ import { scrollLeftTo, scrollTopTo } from './utils';
import { BORDER_TOP_BOTTOM } from '../utils/constant';
import { callInterceptor, Interceptor } from '../utils/interceptor';
-// Composition
+// Composables
import {
useChildren,
useWindowSize,
diff --git a/src/toast/Toast.tsx b/src/toast/Toast.tsx
index 801662428..20a5d30de 100644
--- a/src/toast/Toast.tsx
+++ b/src/toast/Toast.tsx
@@ -60,9 +60,11 @@ export default createComponent({
}
};
+ const updateShow = (show: boolean) => emit('update:show', show);
+
const onClick = () => {
if (props.closeOnClick) {
- emit('update:show', false);
+ updateShow(false);
}
};
@@ -70,8 +72,6 @@ export default createComponent({
clearTimeout(timer);
};
- const toggle = (show: boolean) => emit('update:show', show);
-
const renderIcon = () => {
const { icon, type, iconPrefix, loadingType } = props;
const hasIcon = icon || type === 'success' || type === 'fail';
@@ -109,7 +109,7 @@ export default createComponent({
clearTimer();
if (props.show && props.duration > 0) {
timer = setTimeout(() => {
- emit('update:show', false);
+ updateShow(false);
}, props.duration);
}
});
@@ -132,7 +132,7 @@ export default createComponent({
closeOnClickOverlay={props.closeOnClickOverlay}
onClick={onClick}
onClosed={clearTimer}
- {...{ 'onUpdate:show': toggle }}
+ {...{ 'onUpdate:show': updateShow }}
>
{renderIcon()}
{renderMessage()}
diff --git a/src/uploader/index.tsx b/src/uploader/index.tsx
index a1f63c1b1..e650393ce 100644
--- a/src/uploader/index.tsx
+++ b/src/uploader/index.tsx
@@ -14,7 +14,7 @@ import {
UploaderResultType,
} from './utils';
-// Composition
+// Composables
import { useExpose } from '../composables/use-expose';
import { useLinkField } from '../composables/use-link-field';