mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-05-22 14:39:16 +08:00
chore: expose utils in entry file
This commit is contained in:
parent
da0d5435de
commit
0072f4fe02
@ -1,9 +1,7 @@
|
|||||||
import { ref, computed, watch, nextTick } from 'vue';
|
import { ref, computed, watch, nextTick } from 'vue';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { createNamespace, addUnit } from '../../utils';
|
import { addUnit, unitToPx, setScrollTop, createNamespace } from '../../utils';
|
||||||
import { unitToPx } from '../../utils/format/unit';
|
|
||||||
import { setScrollTop } from '../../utils/dom/scroll';
|
|
||||||
import { getMonthEndDay } from '../../datetime-picker/utils';
|
import { getMonthEndDay } from '../../datetime-picker/utils';
|
||||||
import {
|
import {
|
||||||
t,
|
t,
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
import { ref, watch, reactive, computed, onMounted, onActivated } from 'vue';
|
import { ref, watch, reactive, computed, onMounted, onActivated } from 'vue';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { pick } from '../utils';
|
import { raf, pick, getScrollTop } from '../utils';
|
||||||
import { raf } from '../utils/dom/raf';
|
|
||||||
import { isDate } from '../utils/validate/date';
|
import { isDate } from '../utils/validate/date';
|
||||||
import { getScrollTop } from '../utils/dom/scroll';
|
|
||||||
import {
|
import {
|
||||||
t,
|
t,
|
||||||
bem,
|
bem,
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
import { watch, computed } from 'vue';
|
import { watch, computed } from 'vue';
|
||||||
import { createNamespace, isObject, getSizeStyle } from '../utils';
|
import {
|
||||||
import { raf, cancelRaf } from '../utils/dom/raf';
|
raf,
|
||||||
|
isObject,
|
||||||
|
cancelRaf,
|
||||||
|
getSizeStyle,
|
||||||
|
createNamespace,
|
||||||
|
} from '../utils';
|
||||||
import { BLUE, WHITE } from '../utils/constant';
|
import { BLUE, WHITE } from '../utils/constant';
|
||||||
|
|
||||||
const [createComponent, bem] = createNamespace('circle');
|
const [createComponent, bem] = createNamespace('circle');
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import { ref, watch, computed, nextTick } from 'vue';
|
import { ref, watch, computed, nextTick } from 'vue';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { createNamespace } from '../utils';
|
import { raf, doubleRaf, createNamespace } from '../utils';
|
||||||
import { raf, doubleRaf } from '../utils/dom/raf';
|
|
||||||
|
|
||||||
// Composition
|
// Composition
|
||||||
import { useParent } from '../composition/use-relation';
|
import { useParent } from '../composition/use-relation';
|
||||||
|
@ -8,8 +8,7 @@ import {
|
|||||||
} from 'vue';
|
} from 'vue';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { createNamespace } from '../utils';
|
import { raf, cancelRaf, createNamespace } from '../utils';
|
||||||
import { raf, cancelRaf } from '../utils/dom/raf';
|
|
||||||
import { isSameSecond, parseTimeData, parseFormat } from './utils';
|
import { isSameSecond, parseTimeData, parseFormat } from './utils';
|
||||||
|
|
||||||
// Composition
|
// Composition
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { padZero } from '../utils/format/string';
|
import { padZero } from '../utils';
|
||||||
|
|
||||||
export type TimeData = {
|
export type TimeData = {
|
||||||
days: number;
|
days: number;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { createNamespace } from '../utils';
|
import { padZero, createNamespace } from '../utils';
|
||||||
import { RED } from '../utils/constant';
|
import { RED } from '../utils/constant';
|
||||||
import { padZero } from '../utils/format/string';
|
|
||||||
import Checkbox from '../checkbox';
|
import Checkbox from '../checkbox';
|
||||||
|
|
||||||
const [createComponent, bem, t] = createNamespace('coupon');
|
const [createComponent, bem, t] = createNamespace('coupon');
|
||||||
|
@ -1,11 +1,16 @@
|
|||||||
import { ref, watch, computed, nextTick, onMounted } from 'vue';
|
import { ref, watch, computed, nextTick, onMounted } from 'vue';
|
||||||
import { createNamespace, pick } from '../utils';
|
|
||||||
|
// Utils
|
||||||
import { isDate } from '../utils/validate/date';
|
import { isDate } from '../utils/validate/date';
|
||||||
import { padZero } from '../utils/format/string';
|
import { pick, padZero, createNamespace } from '../utils';
|
||||||
import { times, sharedProps, getTrueValue, getMonthEndDay } from './utils';
|
import { times, sharedProps, getTrueValue, getMonthEndDay } from './utils';
|
||||||
|
|
||||||
|
// Composition
|
||||||
|
import { useExpose } from '../composition/use-expose';
|
||||||
|
|
||||||
|
// Components
|
||||||
import Picker from '../picker';
|
import Picker from '../picker';
|
||||||
import { pickerProps } from '../picker/shared';
|
import { pickerProps } from '../picker/shared';
|
||||||
import { useExpose } from '../composition/use-expose';
|
|
||||||
|
|
||||||
const currentYear = new Date().getFullYear();
|
const currentYear = new Date().getFullYear();
|
||||||
const [createComponent] = createNamespace('date-picker');
|
const [createComponent] = createNamespace('date-picker');
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
import { ref, watch, computed, nextTick, onMounted } from 'vue';
|
import { ref, watch, computed, nextTick, onMounted } from 'vue';
|
||||||
import { createNamespace, pick } from '../utils';
|
|
||||||
import { range } from '../utils/format/number';
|
// Utils
|
||||||
import { padZero } from '../utils/format/string';
|
import { pick, range, padZero, createNamespace } from '../utils';
|
||||||
import { times, sharedProps } from './utils';
|
import { times, sharedProps } from './utils';
|
||||||
|
|
||||||
|
// Composition
|
||||||
|
import { useExpose } from '../composition/use-expose';
|
||||||
|
|
||||||
|
// Components
|
||||||
import Picker from '../picker';
|
import Picker from '../picker';
|
||||||
import { pickerProps } from '../picker/shared';
|
import { pickerProps } from '../picker/shared';
|
||||||
import { useExpose } from '../composition/use-expose';
|
|
||||||
|
|
||||||
const [createComponent] = createNamespace('time-picker');
|
const [createComponent] = createNamespace('time-picker');
|
||||||
|
|
||||||
|
@ -9,15 +9,16 @@ import {
|
|||||||
} from 'vue';
|
} from 'vue';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { resetScroll } from '../utils/dom/reset-scroll';
|
|
||||||
import { formatNumber } from '../utils/format/number';
|
|
||||||
import { trigger, preventDefault } from '../utils/dom/event';
|
|
||||||
import {
|
import {
|
||||||
isDef,
|
isDef,
|
||||||
|
trigger,
|
||||||
addUnit,
|
addUnit,
|
||||||
isObject,
|
isObject,
|
||||||
isPromise,
|
isPromise,
|
||||||
isFunction,
|
isFunction,
|
||||||
|
resetScroll,
|
||||||
|
formatNumber,
|
||||||
|
preventDefault,
|
||||||
createNamespace,
|
createNamespace,
|
||||||
} from '../utils';
|
} from '../utils';
|
||||||
|
|
||||||
|
@ -2,8 +2,7 @@ import { watch, computed, reactive } from 'vue';
|
|||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { bem } from './shared';
|
import { bem } from './shared';
|
||||||
import { range } from '../utils/format/number';
|
import { range, preventDefault } from '../utils';
|
||||||
import { preventDefault } from '../utils/dom/event';
|
|
||||||
|
|
||||||
// Composition
|
// Composition
|
||||||
import { useTouch } from '../composition/use-touch';
|
import { useTouch } from '../composition/use-touch';
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
import { ref, computed, watch, nextTick } from 'vue';
|
import { ref, computed, watch, nextTick } from 'vue';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { createNamespace, isDef } from '../utils';
|
|
||||||
import { isHidden } from '../utils/dom/style';
|
|
||||||
import { preventDefault } from '../utils/dom/event';
|
|
||||||
import {
|
import {
|
||||||
|
isDef,
|
||||||
|
isHidden,
|
||||||
getScrollTop,
|
getScrollTop,
|
||||||
getElementTop,
|
getElementTop,
|
||||||
|
preventDefault,
|
||||||
|
createNamespace,
|
||||||
getRootScrollTop,
|
getRootScrollTop,
|
||||||
setRootScrollTop,
|
setRootScrollTop,
|
||||||
} from '../utils/dom/scroll';
|
} from '../utils';
|
||||||
|
|
||||||
// Composition
|
// Composition
|
||||||
import { useScrollParent, useEventListener } from '@vant/use';
|
import { useScrollParent, useEventListener } from '@vant/use';
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import { ref, watch, nextTick, onUpdated, onMounted } from 'vue';
|
import { ref, watch, nextTick, onUpdated, onMounted } from 'vue';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { createNamespace } from '../utils';
|
import { isHidden, createNamespace } from '../utils';
|
||||||
import { isHidden } from '../utils/dom/style';
|
|
||||||
|
|
||||||
// Composition
|
// Composition
|
||||||
import { useScrollParent, useEventListener } from '@vant/use';
|
import { useScrollParent, useEventListener } from '@vant/use';
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
import { ref, reactive, nextTick, onActivated, watch } from 'vue';
|
import { ref, watch, reactive, nextTick, onActivated } from 'vue';
|
||||||
import { createNamespace, isDef } from '../utils';
|
import { isDef, doubleRaf, createNamespace } from '../utils';
|
||||||
import { doubleRaf } from '../utils/dom/raf';
|
|
||||||
|
// Composition
|
||||||
import { useRect } from '../composition/use-rect';
|
import { useRect } from '../composition/use-rect';
|
||||||
import { useEventListener } from '@vant/use';
|
import { useEventListener } from '@vant/use';
|
||||||
|
|
||||||
|
// Components
|
||||||
import Icon from '../icon';
|
import Icon from '../icon';
|
||||||
|
|
||||||
const [createComponent, bem] = createNamespace('notice-bar');
|
const [createComponent, bem] = createNamespace('notice-bar');
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { ref, watch, computed, Teleport, Transition } from 'vue';
|
import { ref, watch, computed, Teleport, Transition } from 'vue';
|
||||||
import { createNamespace } from '../utils';
|
import { createNamespace, stopPropagation } from '../utils';
|
||||||
import { stopPropagation } from '../utils/dom/event';
|
|
||||||
import { useClickAway } from '@vant/use';
|
import { useClickAway } from '@vant/use';
|
||||||
import Key from './Key';
|
import Key from './Key';
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { Transition } from 'vue';
|
import { Transition } from 'vue';
|
||||||
import { createNamespace, isDef, noop } from '../utils';
|
import { noop, isDef, preventDefault, createNamespace } from '../utils';
|
||||||
import { preventDefault } from '../utils/dom/event';
|
|
||||||
import { useLazyRender } from '../composition/use-lazy-render';
|
import { useLazyRender } from '../composition/use-lazy-render';
|
||||||
|
|
||||||
const [createComponent, bem] = createNamespace('overlay');
|
const [createComponent, bem] = createNamespace('overlay');
|
||||||
|
@ -2,10 +2,8 @@ import { reactive, ref, watch } from 'vue';
|
|||||||
import { PICKER_KEY } from './shared';
|
import { PICKER_KEY } from './shared';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { range } from '../utils/format/number';
|
|
||||||
import { deepClone } from '../utils/deep-clone';
|
import { deepClone } from '../utils/deep-clone';
|
||||||
import { createNamespace, isObject } from '../utils';
|
import { range, isObject, createNamespace, preventDefault } from '../utils';
|
||||||
import { preventDefault } from '../utils/dom/event';
|
|
||||||
|
|
||||||
// Composition
|
// Composition
|
||||||
import { useTouch } from '../composition/use-touch';
|
import { useTouch } from '../composition/use-touch';
|
||||||
|
@ -2,10 +2,8 @@ import { ref, watch, computed } from 'vue';
|
|||||||
import { pickerProps, PICKER_KEY, DEFAULT_ITEM_HEIGHT } from './shared';
|
import { pickerProps, PICKER_KEY, DEFAULT_ITEM_HEIGHT } from './shared';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { createNamespace } from '../utils';
|
import { unitToPx, preventDefault, createNamespace } from '../utils';
|
||||||
import { preventDefault } from '../utils/dom/event';
|
|
||||||
import { BORDER_UNSET_TOP_BOTTOM } from '../utils/constant';
|
import { BORDER_UNSET_TOP_BOTTOM } from '../utils/constant';
|
||||||
import { unitToPx } from '../utils/format/unit';
|
|
||||||
|
|
||||||
// Composition
|
// Composition
|
||||||
import { useExpose } from '../composition/use-expose';
|
import { useExpose } from '../composition/use-expose';
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
import { ref, watch, reactive, nextTick } from 'vue';
|
import { ref, watch, reactive, nextTick } from 'vue';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { createNamespace } from '../utils';
|
import { preventDefault, getScrollTop, createNamespace } from '../utils';
|
||||||
import { getScrollTop } from '../utils/dom/scroll';
|
|
||||||
import { preventDefault } from '../utils/dom/event';
|
|
||||||
|
|
||||||
// Composition
|
// Composition
|
||||||
import { useScrollParent } from '@vant/use';
|
import { useScrollParent } from '@vant/use';
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { createNamespace, addUnit } from '../utils';
|
import { addUnit, createNamespace, preventDefault } from '../utils';
|
||||||
import { preventDefault } from '../utils/dom/event';
|
|
||||||
|
|
||||||
// Composition
|
// Composition
|
||||||
import { useRefs } from '../composition/use-refs';
|
import { useRefs } from '../composition/use-refs';
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// Utils
|
// Utils
|
||||||
import { createNamespace, pick } from '../utils';
|
import { pick, createNamespace, preventDefault } from '../utils';
|
||||||
import { preventDefault } from '../utils/dom/event';
|
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import Field from '../field';
|
import Field from '../field';
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { createNamespace, addUnit, getSizeStyle } from '../utils';
|
import {
|
||||||
|
addUnit,
|
||||||
|
getSizeStyle,
|
||||||
|
preventDefault,
|
||||||
|
createNamespace,
|
||||||
|
} from '../utils';
|
||||||
import { deepClone } from '../utils/deep-clone';
|
import { deepClone } from '../utils/deep-clone';
|
||||||
import { preventDefault } from '../utils/dom/event';
|
|
||||||
|
|
||||||
// Composition
|
// Composition
|
||||||
import { useRect } from '../composition/use-rect';
|
import { useRect } from '../composition/use-rect';
|
||||||
|
@ -1,11 +1,16 @@
|
|||||||
import { ref, computed, watch } from 'vue';
|
import { ref, watch, computed } from 'vue';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { isNaN } from '../utils/validate/number';
|
import { isNaN } from '../utils/validate/number';
|
||||||
import { formatNumber } from '../utils/format/number';
|
import {
|
||||||
import { resetScroll } from '../utils/dom/reset-scroll';
|
isDef,
|
||||||
import { preventDefault } from '../utils/dom/event';
|
addUnit,
|
||||||
import { createNamespace, isDef, addUnit, getSizeStyle } from '../utils';
|
resetScroll,
|
||||||
|
formatNumber,
|
||||||
|
getSizeStyle,
|
||||||
|
preventDefault,
|
||||||
|
createNamespace,
|
||||||
|
} from '../utils';
|
||||||
|
|
||||||
// Composition
|
// Composition
|
||||||
import { useLinkField } from '../composition/use-link-field';
|
import { useLinkField } from '../composition/use-link-field';
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
import { ref, reactive, computed } from 'vue';
|
import { ref, reactive, computed } from 'vue';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { isHidden } from '../utils/dom/style';
|
import {
|
||||||
import { unitToPx } from '../utils/format/unit';
|
isHidden,
|
||||||
import { createNamespace } from '../utils';
|
unitToPx,
|
||||||
import { getScrollTop, getElementTop } from '../utils/dom/scroll';
|
getScrollTop,
|
||||||
|
getElementTop,
|
||||||
|
createNamespace,
|
||||||
|
} from '../utils';
|
||||||
|
|
||||||
// Composition
|
// Composition
|
||||||
import { useScrollParent, useEventListener } from '@vant/use';
|
import { useScrollParent, useEventListener } from '@vant/use';
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
import { ref, reactive, computed } from 'vue';
|
import { ref, reactive, computed } from 'vue';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { createNamespace } from '../utils';
|
import { range, createNamespace, preventDefault } from '../utils';
|
||||||
import { range } from '../utils/format/number';
|
|
||||||
import { preventDefault } from '../utils/dom/event';
|
|
||||||
import { callInterceptor } from '../utils/interceptor';
|
import { callInterceptor } from '../utils/interceptor';
|
||||||
|
|
||||||
// Composition
|
// Composition
|
||||||
|
@ -10,11 +10,13 @@ import {
|
|||||||
} from 'vue';
|
} from 'vue';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { createNamespace } from '../utils';
|
import {
|
||||||
import { range } from '../utils/format/number';
|
range,
|
||||||
import { isHidden } from '../utils/dom/style';
|
isHidden,
|
||||||
import { doubleRaf } from '../utils/dom/raf';
|
doubleRaf,
|
||||||
import { preventDefault } from '../utils/dom/event';
|
preventDefault,
|
||||||
|
createNamespace,
|
||||||
|
} from '../utils';
|
||||||
|
|
||||||
// Composition
|
// Composition
|
||||||
import { usePageVisibility, useWindowSize } from '@vant/use';
|
import { usePageVisibility, useWindowSize } from '@vant/use';
|
||||||
|
@ -9,22 +9,24 @@ import {
|
|||||||
} from 'vue';
|
} from 'vue';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { createNamespace, isDef, addUnit } from '../utils';
|
|
||||||
import { scrollLeftTo, scrollTopTo } from './utils';
|
|
||||||
import { route } from '../composition/use-route';
|
|
||||||
import { isHidden } from '../utils/dom/style';
|
|
||||||
import { unitToPx } from '../utils/format/unit';
|
|
||||||
import { BORDER_TOP_BOTTOM } from '../utils/constant';
|
|
||||||
import { callInterceptor } from '../utils/interceptor';
|
|
||||||
import {
|
import {
|
||||||
|
isDef,
|
||||||
|
addUnit,
|
||||||
|
isHidden,
|
||||||
|
unitToPx,
|
||||||
getVisibleTop,
|
getVisibleTop,
|
||||||
getElementTop,
|
getElementTop,
|
||||||
|
createNamespace,
|
||||||
getVisibleHeight,
|
getVisibleHeight,
|
||||||
setRootScrollTop,
|
setRootScrollTop,
|
||||||
} from '../utils/dom/scroll';
|
} from '../utils';
|
||||||
|
import { scrollLeftTo, scrollTopTo } from './utils';
|
||||||
|
import { BORDER_TOP_BOTTOM } from '../utils/constant';
|
||||||
|
import { callInterceptor } from '../utils/interceptor';
|
||||||
|
|
||||||
// Composition
|
// Composition
|
||||||
import { useWindowSize, useScrollParent, useEventListener } from '@vant/use';
|
import { useWindowSize, useScrollParent, useEventListener } from '@vant/use';
|
||||||
|
import { route } from '../composition/use-route';
|
||||||
import { useRefs } from '../composition/use-refs';
|
import { useRefs } from '../composition/use-refs';
|
||||||
import { useExpose } from '../composition/use-expose';
|
import { useExpose } from '../composition/use-expose';
|
||||||
import { useChildren } from '../composition/use-relation';
|
import { useChildren } from '../composition/use-relation';
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
import { raf, cancelRaf } from '../utils/dom/raf';
|
import { raf, cancelRaf, getScrollTop, setScrollTop } from '../utils';
|
||||||
import { getScrollTop, setScrollTop } from '../utils/dom/scroll';
|
|
||||||
|
|
||||||
let scrollLeftRafId: number;
|
let rafId: number;
|
||||||
|
|
||||||
export function scrollLeftTo(
|
export function scrollLeftTo(
|
||||||
scroller: HTMLElement,
|
scroller: HTMLElement,
|
||||||
to: number,
|
to: number,
|
||||||
duration: number
|
duration: number
|
||||||
) {
|
) {
|
||||||
cancelRaf(scrollLeftRafId);
|
cancelRaf(rafId);
|
||||||
|
|
||||||
let count = 0;
|
let count = 0;
|
||||||
const from = scroller.scrollLeft;
|
const from = scroller.scrollLeft;
|
||||||
@ -18,7 +17,7 @@ export function scrollLeftTo(
|
|||||||
scroller.scrollLeft += (to - from) / frames;
|
scroller.scrollLeft += (to - from) / frames;
|
||||||
|
|
||||||
if (++count < frames) {
|
if (++count < frames) {
|
||||||
scrollLeftRafId = raf(animate);
|
rafId = raf(animate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* Create a basic component with common options
|
* Create a basic component with common options
|
||||||
*/
|
*/
|
||||||
import { camelize } from '../format/string';
|
|
||||||
import { App, defineComponent, ComponentOptionsWithObjectProps } from 'vue';
|
import { App, defineComponent, ComponentOptionsWithObjectProps } from 'vue';
|
||||||
|
import { camelize } from '..';
|
||||||
|
|
||||||
export function createComponent(name: string) {
|
export function createComponent(name: string) {
|
||||||
return function (sfc: ComponentOptionsWithObjectProps) {
|
return function (sfc: ComponentOptionsWithObjectProps) {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { get, isFunction } from '..';
|
import { get, camelize, isFunction } from '..';
|
||||||
import { camelize } from '../format/string';
|
|
||||||
import locale from '../../locale';
|
import locale from '../../locale';
|
||||||
|
|
||||||
export function createI18N(name: string) {
|
export function createI18N(name: string) {
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
/**
|
|
||||||
* Hack for iOS12 page scroll
|
|
||||||
* https://developers.weixin.qq.com/community/develop/doc/00044ae90742f8c82fb78fcae56800
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { isIOS as checkIsIOS } from '../validate/system';
|
|
||||||
import { getRootScrollTop, setRootScrollTop } from './scroll';
|
|
||||||
|
|
||||||
const isIOS = checkIsIOS();
|
|
||||||
|
|
||||||
export function resetScroll() {
|
|
||||||
if (isIOS) {
|
|
||||||
setRootScrollTop(getRootScrollTop());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +1,5 @@
|
|||||||
|
import { isIOS as checkIsIOS } from '../validate/system';
|
||||||
|
|
||||||
type ScrollElement = HTMLElement | Window;
|
type ScrollElement = HTMLElement | Window;
|
||||||
|
|
||||||
function isWindow(val: unknown): val is Window {
|
function isWindow(val: unknown): val is Window {
|
||||||
@ -56,3 +58,13 @@ export function getVisibleTop(el: ScrollElement) {
|
|||||||
}
|
}
|
||||||
return el.getBoundingClientRect().top;
|
return el.getBoundingClientRect().top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isIOS = checkIsIOS();
|
||||||
|
|
||||||
|
// hack for iOS12 page scroll
|
||||||
|
// see: https://developers.weixin.qq.com/community/develop/doc/00044ae90742f8c82fb78fcae56800
|
||||||
|
export function resetScroll() {
|
||||||
|
if (isIOS) {
|
||||||
|
setRootScrollTop(getRootScrollTop());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
export { addUnit, getSizeStyle } from './format/unit';
|
export * from './create';
|
||||||
export { createNamespace } from './create';
|
export * from './format/unit';
|
||||||
|
export * from './format/number';
|
||||||
|
export * from './format/string';
|
||||||
|
export * from './dom/raf';
|
||||||
|
export * from './dom/style';
|
||||||
|
export * from './dom/event';
|
||||||
|
export * from './dom/scroll';
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||||
export function noop() {}
|
export function noop() {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user