mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
chore: rename variables and comments
This commit is contained in:
parent
a0addef294
commit
6e5329cbe0
@ -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';
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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()}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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';
|
||||
|
@ -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()}
|
||||
</Popup>
|
||||
|
@ -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
|
||||
|
@ -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 () => <div class={bem([props.direction])}>{slots.default?.()}</div>;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -19,7 +19,7 @@ import {
|
||||
DatetimePickerType,
|
||||
} from './utils';
|
||||
|
||||
// Composition
|
||||
// Composables
|
||||
import { useExpose } from '../composables/use-expose';
|
||||
|
||||
// Components
|
||||
|
@ -10,7 +10,7 @@ import {
|
||||
} from '../utils';
|
||||
import { times, sharedProps, pickerKeys } from './utils';
|
||||
|
||||
// Composition
|
||||
// Composables
|
||||
import { useExpose } from '../composables/use-expose';
|
||||
|
||||
// Components
|
||||
|
@ -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()}
|
||||
|
@ -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';
|
||||
|
||||
|
@ -3,7 +3,7 @@ import { ref, computed, PropType, CSSProperties, Ref } from 'vue';
|
||||
// Utils
|
||||
import { isDef, ComponentInstance, createNamespace } from '../utils';
|
||||
|
||||
// Composition
|
||||
// Composables
|
||||
import {
|
||||
useRect,
|
||||
useChildren,
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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()}
|
||||
|
@ -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
|
||||
|
@ -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';
|
||||
|
||||
|
@ -20,7 +20,7 @@ import {
|
||||
ComponentInstance,
|
||||
} from '../utils';
|
||||
|
||||
// Composition
|
||||
// Composables
|
||||
import {
|
||||
useRect,
|
||||
useChildren,
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { ref, watch, reactive, PropType } from 'vue';
|
||||
import { isDef, createNamespace } from '../utils';
|
||||
|
||||
// Composition
|
||||
// Composables
|
||||
import {
|
||||
raf,
|
||||
useRect,
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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 }}
|
||||
>
|
||||
<div class={bem('arrow')} />
|
||||
<div role="menu" class={bem('content')}>
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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';
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
ComponentInstance,
|
||||
} from '../utils';
|
||||
|
||||
// Composition
|
||||
// Composables
|
||||
import { useExpose } from '../composables/use-expose';
|
||||
|
||||
// Components
|
||||
|
@ -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()}
|
||||
|
@ -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';
|
||||
|
@ -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
|
||||
|
@ -12,7 +12,7 @@ import {
|
||||
createNamespace,
|
||||
} from '../utils';
|
||||
|
||||
// Composition
|
||||
// Composables
|
||||
import { useLinkField } from '../composables/use-link-field';
|
||||
import { Interceptor, callInterceptor } from '../utils/interceptor';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
@ -20,7 +20,7 @@ import {
|
||||
ComponentInstance,
|
||||
} from '../utils';
|
||||
|
||||
// Composition
|
||||
// Composables
|
||||
import {
|
||||
useRect,
|
||||
doubleRaf,
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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()}
|
||||
|
@ -14,7 +14,7 @@ import {
|
||||
UploaderResultType,
|
||||
} from './utils';
|
||||
|
||||
// Composition
|
||||
// Composables
|
||||
import { useExpose } from '../composables/use-expose';
|
||||
import { useLinkField } from '../composables/use-link-field';
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user