vant 3.6.1 → 3.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -5
- package/changelog.generated.md +33 -43
- package/es/action-bar/ActionBar.d.ts +1 -1
- package/es/action-bar/index.d.ts +1 -1
- package/es/action-bar-button/ActionBarButton.d.ts +1 -1
- package/es/action-bar-button/index.d.ts +1 -1
- package/es/action-bar-icon/ActionBarIcon.d.ts +1 -1
- package/es/action-bar-icon/index.d.ts +1 -1
- package/es/badge/Badge.d.ts +1 -1
- package/es/badge/index.d.ts +1 -1
- package/es/calendar/Calendar.mjs +4 -3
- package/es/cell/Cell.d.ts +1 -1
- package/es/cell/index.d.ts +1 -1
- package/es/cell-group/CellGroup.d.ts +1 -1
- package/es/cell-group/index.d.ts +1 -1
- package/es/col/Col.d.ts +1 -1
- package/es/col/index.d.ts +1 -1
- package/es/collapse-item/CollapseItem.d.ts +1 -1
- package/es/collapse-item/index.d.ts +1 -1
- package/es/composables/use-lazy-render.mjs +9 -5
- package/es/composables/use-lock-scroll.mjs +4 -1
- package/es/composables/use-visibility-change.mjs +6 -3
- package/es/config-provider/ConfigProvider.d.ts +1 -1
- package/es/config-provider/index.d.ts +1 -1
- package/es/coupon/Coupon.d.ts +1 -1
- package/es/coupon/index.d.ts +1 -1
- package/es/coupon/utils.mjs +3 -1
- package/es/coupon-cell/CouponCell.d.ts +1 -1
- package/es/coupon-cell/index.d.ts +1 -1
- package/es/datetime-picker/DatetimePicker.d.ts +1 -1
- package/es/datetime-picker/index.d.ts +1 -1
- package/es/dialog/index.css +1 -1
- package/es/dialog/index.less +4 -0
- package/es/dialog/types.d.ts +1 -1
- package/es/divider/Divider.d.ts +1 -1
- package/es/divider/index.d.ts +1 -1
- package/es/dropdown-item/DropdownItem.d.ts +2 -2
- package/es/dropdown-item/index.d.ts +2 -2
- package/es/dropdown-menu/DropdownMenu.d.ts +1 -1
- package/es/dropdown-menu/index.d.ts +1 -1
- package/es/empty/Empty.d.ts +1 -1
- package/es/empty/index.d.ts +1 -1
- package/es/field/Field.mjs +10 -3
- package/es/grid/Grid.d.ts +1 -1
- package/es/grid/index.d.ts +1 -1
- package/es/grid-item/GridItem.d.ts +1 -1
- package/es/grid-item/index.d.ts +1 -1
- package/es/icon/Icon.d.ts +1 -1
- package/es/icon/index.d.ts +1 -1
- package/es/image/Image.d.ts +4 -0
- package/es/image/Image.mjs +3 -1
- package/es/image/index.css +1 -1
- package/es/image/index.d.ts +3 -0
- package/es/image/index.less +4 -0
- package/es/image-preview/ImagePreviewItem.mjs +10 -2
- package/es/index-anchor/IndexAnchor.d.ts +1 -1
- package/es/index-anchor/index.d.ts +1 -1
- package/es/index-bar/IndexBar.mjs +7 -3
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/lazyload/vue-lazyload/lazy-component.mjs +4 -1
- package/es/lazyload/vue-lazyload/lazy-container.mjs +11 -7
- package/es/lazyload/vue-lazyload/lazy-image.mjs +24 -14
- package/es/lazyload/vue-lazyload/lazy.mjs +11 -3
- package/es/lazyload/vue-lazyload/listener.mjs +45 -33
- package/es/lazyload/vue-lazyload/util.mjs +4 -1
- package/es/loading/Loading.d.ts +1 -1
- package/es/loading/index.d.ts +1 -1
- package/es/number-keyboard/NumberKeyboard.d.ts +1 -1
- package/es/number-keyboard/index.d.ts +1 -1
- package/es/overlay/Overlay.d.ts +1 -1
- package/es/overlay/Overlay.mjs +13 -6
- package/es/overlay/index.d.ts +1 -1
- package/es/picker/Picker.mjs +7 -3
- package/es/picker/PickerColumn.mjs +6 -2
- package/es/popup/Popup.d.ts +2 -2
- package/es/popup/index.d.ts +2 -2
- package/es/popup/shared.mjs +3 -1
- package/es/progress/Progress.d.ts +1 -1
- package/es/progress/index.d.ts +1 -1
- package/es/rate/Rate.mjs +5 -3
- package/es/row/Row.d.ts +1 -1
- package/es/row/index.d.ts +1 -1
- package/es/skeleton/Skeleton.d.ts +1 -1
- package/es/skeleton/index.d.ts +1 -1
- package/es/slider/Slider.mjs +6 -2
- package/es/space/Space.d.ts +1 -1
- package/es/space/index.d.ts +1 -1
- package/es/step/Step.d.ts +1 -1
- package/es/step/index.d.ts +1 -1
- package/es/swipe/Swipe.mjs +13 -6
- package/es/swipe-cell/SwipeCell.d.ts +2 -2
- package/es/swipe-cell/SwipeCell.mjs +4 -2
- package/es/swipe-cell/index.d.ts +2 -2
- package/es/swipe-item/SwipeItem.d.ts +1 -1
- package/es/swipe-item/index.d.ts +1 -1
- package/es/tab/Tab.d.ts +1 -1
- package/es/tab/Tab.mjs +12 -2
- package/es/tab/index.d.ts +1 -1
- package/es/tabs/Tabs.d.ts +1 -1
- package/es/tabs/Tabs.mjs +11 -11
- package/es/tabs/TabsTitle.d.ts +1 -1
- package/es/tabs/index.d.ts +1 -1
- package/es/utils/basic.mjs +2 -1
- package/es/utils/create.mjs +8 -2
- package/es/utils/with-install.d.ts +2 -2
- package/es/utils/with-install.mjs +4 -2
- package/lib/action-bar/ActionBar.d.ts +1 -1
- package/lib/action-bar/index.d.ts +1 -1
- package/lib/action-bar/index.js +4 -1
- package/lib/action-bar-button/ActionBarButton.d.ts +1 -1
- package/lib/action-bar-button/index.d.ts +1 -1
- package/lib/action-bar-button/index.js +4 -1
- package/lib/action-bar-icon/ActionBarIcon.d.ts +1 -1
- package/lib/action-bar-icon/index.d.ts +1 -1
- package/lib/action-bar-icon/index.js +4 -1
- package/lib/action-sheet/index.js +4 -1
- package/lib/address-edit/AddressEdit.js +4 -1
- package/lib/address-edit/index.js +4 -1
- package/lib/address-list/AddressList.js +4 -1
- package/lib/address-list/index.js +4 -1
- package/lib/area/index.js +4 -1
- package/lib/badge/Badge.d.ts +1 -1
- package/lib/badge/index.d.ts +1 -1
- package/lib/badge/index.js +4 -1
- package/lib/button/index.js +4 -1
- package/lib/calendar/Calendar.js +8 -4
- package/lib/calendar/CalendarMonth.js +4 -1
- package/lib/calendar/index.js +4 -1
- package/lib/card/index.js +4 -1
- package/lib/cascader/index.js +4 -1
- package/lib/cell/Cell.d.ts +1 -1
- package/lib/cell/index.d.ts +1 -1
- package/lib/cell/index.js +4 -1
- package/lib/cell-group/CellGroup.d.ts +1 -1
- package/lib/cell-group/index.d.ts +1 -1
- package/lib/cell-group/index.js +4 -1
- package/lib/checkbox/Checkbox.js +4 -1
- package/lib/checkbox/index.js +4 -1
- package/lib/checkbox-group/index.js +4 -1
- package/lib/circle/index.js +4 -1
- package/lib/col/Col.d.ts +1 -1
- package/lib/col/index.d.ts +1 -1
- package/lib/col/index.js +4 -1
- package/lib/collapse/index.js +4 -1
- package/lib/collapse-item/CollapseItem.d.ts +1 -1
- package/lib/collapse-item/index.d.ts +1 -1
- package/lib/collapse-item/index.js +4 -1
- package/lib/composables/use-lazy-render.js +9 -5
- package/lib/composables/use-lock-scroll.js +4 -1
- package/lib/composables/use-visibility-change.js +6 -3
- package/lib/config-provider/ConfigProvider.d.ts +1 -1
- package/lib/config-provider/index.d.ts +1 -1
- package/lib/config-provider/index.js +4 -1
- package/lib/contact-card/index.js +4 -1
- package/lib/contact-edit/index.js +4 -1
- package/lib/contact-list/index.js +4 -1
- package/lib/count-down/index.js +4 -1
- package/lib/coupon/Coupon.d.ts +1 -1
- package/lib/coupon/index.d.ts +1 -1
- package/lib/coupon/index.js +4 -1
- package/lib/coupon/utils.js +3 -1
- package/lib/coupon-cell/CouponCell.d.ts +1 -1
- package/lib/coupon-cell/index.d.ts +1 -1
- package/lib/coupon-cell/index.js +4 -1
- package/lib/coupon-list/index.js +4 -1
- package/lib/datetime-picker/DatetimePicker.d.ts +1 -1
- package/lib/datetime-picker/DatetimePicker.js +4 -1
- package/lib/datetime-picker/index.d.ts +1 -1
- package/lib/datetime-picker/index.js +4 -1
- package/lib/dialog/function-call.js +4 -1
- package/lib/dialog/index.css +1 -1
- package/lib/dialog/index.less +4 -0
- package/lib/dialog/types.d.ts +1 -1
- package/lib/divider/Divider.d.ts +1 -1
- package/lib/divider/index.d.ts +1 -1
- package/lib/divider/index.js +4 -1
- package/lib/dropdown-item/DropdownItem.d.ts +2 -2
- package/lib/dropdown-item/index.d.ts +2 -2
- package/lib/dropdown-item/index.js +4 -1
- package/lib/dropdown-menu/DropdownMenu.d.ts +1 -1
- package/lib/dropdown-menu/index.d.ts +1 -1
- package/lib/dropdown-menu/index.js +4 -1
- package/lib/empty/Empty.d.ts +1 -1
- package/lib/empty/index.d.ts +1 -1
- package/lib/empty/index.js +4 -1
- package/lib/field/Field.js +9 -2
- package/lib/field/index.js +4 -1
- package/lib/form/index.js +4 -1
- package/lib/grid/Grid.d.ts +1 -1
- package/lib/grid/index.d.ts +1 -1
- package/lib/grid/index.js +4 -1
- package/lib/grid-item/GridItem.d.ts +1 -1
- package/lib/grid-item/index.d.ts +1 -1
- package/lib/grid-item/index.js +4 -1
- package/lib/icon/Icon.d.ts +1 -1
- package/lib/icon/index.d.ts +1 -1
- package/lib/icon/index.js +4 -1
- package/lib/image/Image.d.ts +4 -0
- package/lib/image/Image.js +3 -1
- package/lib/image/index.css +1 -1
- package/lib/image/index.d.ts +3 -0
- package/lib/image/index.js +4 -1
- package/lib/image/index.less +4 -0
- package/lib/image-preview/ImagePreview.js +4 -1
- package/lib/image-preview/ImagePreviewItem.js +9 -1
- package/lib/image-preview/function-call.js +4 -1
- package/lib/index-anchor/IndexAnchor.d.ts +1 -1
- package/lib/index-anchor/index.d.ts +1 -1
- package/lib/index-anchor/index.js +4 -1
- package/lib/index-bar/IndexBar.js +7 -3
- package/lib/index-bar/index.js +4 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/lazyload/vue-lazyload/index.js +4 -1
- package/lib/lazyload/vue-lazyload/lazy-component.js +4 -1
- package/lib/lazyload/vue-lazyload/lazy-container.js +11 -7
- package/lib/lazyload/vue-lazyload/lazy-image.js +24 -14
- package/lib/lazyload/vue-lazyload/lazy.js +15 -4
- package/lib/lazyload/vue-lazyload/listener.js +45 -33
- package/lib/lazyload/vue-lazyload/util.js +4 -1
- package/lib/list/index.js +4 -1
- package/lib/loading/Loading.d.ts +1 -1
- package/lib/loading/index.d.ts +1 -1
- package/lib/loading/index.js +4 -1
- package/lib/locale/index.js +4 -1
- package/lib/nav-bar/index.js +4 -1
- package/lib/notice-bar/index.js +4 -1
- package/lib/notify/function-call.js +4 -1
- package/lib/number-keyboard/NumberKeyboard.d.ts +1 -1
- package/lib/number-keyboard/NumberKeyboard.js +4 -1
- package/lib/number-keyboard/index.d.ts +1 -1
- package/lib/number-keyboard/index.js +4 -1
- package/lib/overlay/Overlay.d.ts +1 -1
- package/lib/overlay/Overlay.js +11 -4
- package/lib/overlay/index.d.ts +1 -1
- package/lib/overlay/index.js +4 -1
- package/lib/pagination/index.js +4 -1
- package/lib/password-input/index.js +4 -1
- package/lib/picker/Picker.js +10 -3
- package/lib/picker/PickerColumn.js +5 -1
- package/lib/picker/index.js +4 -1
- package/lib/popover/index.js +4 -1
- package/lib/popup/Popup.d.ts +2 -2
- package/lib/popup/index.d.ts +2 -2
- package/lib/popup/index.js +4 -1
- package/lib/popup/shared.js +3 -1
- package/lib/progress/Progress.d.ts +1 -1
- package/lib/progress/index.d.ts +1 -1
- package/lib/progress/index.js +4 -1
- package/lib/pull-refresh/index.js +4 -1
- package/lib/radio/Radio.js +4 -1
- package/lib/radio/index.js +4 -1
- package/lib/radio-group/index.js +4 -1
- package/lib/rate/Rate.js +4 -2
- package/lib/rate/index.js +4 -1
- package/lib/row/Row.d.ts +1 -1
- package/lib/row/index.d.ts +1 -1
- package/lib/row/index.js +4 -1
- package/lib/search/index.js +4 -1
- package/lib/share-sheet/index.js +4 -1
- package/lib/sidebar/index.js +4 -1
- package/lib/sidebar-item/index.js +4 -1
- package/lib/skeleton/Skeleton.d.ts +1 -1
- package/lib/skeleton/index.d.ts +1 -1
- package/lib/skeleton/index.js +4 -1
- package/lib/slider/Slider.js +5 -1
- package/lib/slider/index.js +4 -1
- package/lib/space/Space.d.ts +1 -1
- package/lib/space/index.d.ts +1 -1
- package/lib/space/index.js +4 -1
- package/lib/step/Step.d.ts +1 -1
- package/lib/step/index.d.ts +1 -1
- package/lib/step/index.js +4 -1
- package/lib/stepper/index.js +4 -1
- package/lib/steps/index.js +4 -1
- package/lib/sticky/index.js +4 -1
- package/lib/submit-bar/index.js +4 -1
- package/lib/swipe/Swipe.js +12 -5
- package/lib/swipe/index.js +4 -1
- package/lib/swipe-cell/SwipeCell.d.ts +2 -2
- package/lib/swipe-cell/SwipeCell.js +3 -1
- package/lib/swipe-cell/index.d.ts +2 -2
- package/lib/swipe-cell/index.js +4 -1
- package/lib/swipe-item/SwipeItem.d.ts +1 -1
- package/lib/swipe-item/index.d.ts +1 -1
- package/lib/swipe-item/index.js +4 -1
- package/lib/switch/index.js +4 -1
- package/lib/tab/Tab.d.ts +1 -1
- package/lib/tab/Tab.js +11 -1
- package/lib/tab/index.d.ts +1 -1
- package/lib/tab/index.js +4 -1
- package/lib/tabbar/index.js +4 -1
- package/lib/tabbar-item/index.js +4 -1
- package/lib/tabs/Tabs.d.ts +1 -1
- package/lib/tabs/Tabs.js +15 -12
- package/lib/tabs/TabsTitle.d.ts +1 -1
- package/lib/tabs/index.d.ts +1 -1
- package/lib/tabs/index.js +4 -1
- package/lib/tag/index.js +4 -1
- package/lib/toast/function-call.js +4 -1
- package/lib/tree-select/index.js +4 -1
- package/lib/uploader/Uploader.js +4 -1
- package/lib/uploader/index.js +4 -1
- package/lib/utils/basic.js +2 -1
- package/lib/utils/create.js +12 -3
- package/lib/utils/with-install.d.ts +2 -2
- package/lib/utils/with-install.js +4 -2
- package/lib/vant.cjs.js +248 -126
- package/lib/vant.es.js +248 -126
- package/lib/vant.js +290 -151
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1389 -1379
- package/package.json +8 -7
package/lib/vant.es.js
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
import { useWindowSize, useRect, useChildren, useParent, onMountedOrActivated, getScrollParent, useEventListener, CUSTOM_FIELD_INJECTION_KEY, useCustomFieldValue, useToggle, raf, useScrollParent, usePageVisibility, doubleRaf, cancelRaf, useCountDown, useClickAway, inBrowser as inBrowser$1 } from "@vant/use";
|
2
2
|
import { unref, ref, reactive, inject, watch, onMounted, nextTick, createVNode, defineComponent, getCurrentInstance, computed, provide, watchEffect, mergeProps, onDeactivated, onBeforeUnmount, Transition, withDirectives, vShow, onActivated, Teleport, Fragment, createTextVNode, createApp, onUnmounted, onBeforeUpdate, resolveDirective, withKeys, onUpdated, h } from "vue";
|
3
3
|
import { offsetModifier, createPopper } from "@vant/popperjs";
|
4
|
+
const isDef = (val) => val !== void 0 && val !== null;
|
5
|
+
const isFunction = (val) => typeof val === "function";
|
6
|
+
const isObject = (val) => val !== null && typeof val === "object";
|
7
|
+
const isPromise = (val) => isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
8
|
+
const isDate = (val) => Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
|
9
|
+
function isMobile(value) {
|
10
|
+
value = value.replace(/[^-|\d]/g, "");
|
11
|
+
return /^((\+86)|(86))?(1)\d{10}$/.test(value) || /^0[0-9-]{10,13}$/.test(value);
|
12
|
+
}
|
13
|
+
const isNumeric = (val) => typeof val === "number" || /^\d+(\.\d+)?$/.test(val);
|
14
|
+
const isIOS$1 = () => inBrowser ? /ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase()) : false;
|
4
15
|
function noop() {
|
5
16
|
}
|
6
17
|
const extend = Object.assign;
|
@@ -10,7 +21,7 @@ function get(object, path) {
|
|
10
21
|
let result = object;
|
11
22
|
keys.forEach((key) => {
|
12
23
|
var _a;
|
13
|
-
result = (_a = result[key]) != null ? _a : "";
|
24
|
+
result = isObject(result) ? (_a = result[key]) != null ? _a : "" : "";
|
14
25
|
});
|
15
26
|
return result;
|
16
27
|
}
|
@@ -49,17 +60,6 @@ const makeStringProp = (defaultVal) => ({
|
|
49
60
|
type: String,
|
50
61
|
default: defaultVal
|
51
62
|
});
|
52
|
-
const isDef = (val) => val !== void 0 && val !== null;
|
53
|
-
const isFunction = (val) => typeof val === "function";
|
54
|
-
const isObject = (val) => val !== null && typeof val === "object";
|
55
|
-
const isPromise = (val) => isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
56
|
-
const isDate = (val) => Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
|
57
|
-
function isMobile(value) {
|
58
|
-
value = value.replace(/[^-|\d]/g, "");
|
59
|
-
return /^((\+86)|(86))?(1)\d{10}$/.test(value) || /^0[0-9-]{10,13}$/.test(value);
|
60
|
-
}
|
61
|
-
const isNumeric = (val) => typeof val === "number" || /^\d+(\.\d+)?$/.test(val);
|
62
|
-
const isIOS$1 = () => inBrowser ? /ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase()) : false;
|
63
63
|
function getScrollTop(el) {
|
64
64
|
const top = "scrollTop" in el ? el.scrollTop : el.pageYOffset;
|
65
65
|
return Math.max(top, 0);
|
@@ -330,9 +330,15 @@ function genBem(name2, mods) {
|
|
330
330
|
return ` ${name2}--${mods}`;
|
331
331
|
}
|
332
332
|
if (Array.isArray(mods)) {
|
333
|
-
return mods.reduce(
|
334
|
-
|
335
|
-
|
333
|
+
return mods.reduce(
|
334
|
+
(ret, item) => ret + genBem(name2, item),
|
335
|
+
""
|
336
|
+
);
|
337
|
+
}
|
338
|
+
return Object.keys(mods).reduce(
|
339
|
+
(ret, key) => ret + (mods[key] ? genBem(name2, key) : ""),
|
340
|
+
""
|
341
|
+
);
|
336
342
|
}
|
337
343
|
function createBEM(name2) {
|
338
344
|
return (el, mods) => {
|
@@ -388,8 +394,10 @@ function callInterceptor(interceptor, {
|
|
388
394
|
function withInstall(options) {
|
389
395
|
options.install = (app) => {
|
390
396
|
const { name: name2 } = options;
|
391
|
-
|
392
|
-
|
397
|
+
if (name2) {
|
398
|
+
app.component(name2, options);
|
399
|
+
app.component(camelize(`-${name2}`), options);
|
400
|
+
}
|
393
401
|
};
|
394
402
|
return options;
|
395
403
|
}
|
@@ -1018,7 +1026,9 @@ const popupSharedProps = {
|
|
1018
1026
|
transitionAppear: Boolean,
|
1019
1027
|
closeOnClickOverlay: truthProp
|
1020
1028
|
};
|
1021
|
-
const popupSharedPropKeys = Object.keys(
|
1029
|
+
const popupSharedPropKeys = Object.keys(
|
1030
|
+
popupSharedProps
|
1031
|
+
);
|
1022
1032
|
function getDirection(x, y) {
|
1023
1033
|
if (x > y) {
|
1024
1034
|
return "horizontal";
|
@@ -1085,7 +1095,10 @@ function useLockScroll(rootRef, shouldLock) {
|
|
1085
1095
|
const onTouchMove = (event) => {
|
1086
1096
|
touch.move(event);
|
1087
1097
|
const direction = touch.deltaY.value > 0 ? DIRECTION_DOWN : DIRECTION_UP;
|
1088
|
-
const el = getScrollParent(
|
1098
|
+
const el = getScrollParent(
|
1099
|
+
event.target,
|
1100
|
+
rootRef.value
|
1101
|
+
);
|
1089
1102
|
const { scrollHeight, offsetHeight, scrollTop } = el;
|
1090
1103
|
let status = "11";
|
1091
1104
|
if (scrollTop === 0) {
|
@@ -1126,11 +1139,15 @@ function useLockScroll(rootRef, shouldLock) {
|
|
1126
1139
|
}
|
1127
1140
|
function useLazyRender(show) {
|
1128
1141
|
const inited = ref(false);
|
1129
|
-
watch(
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1142
|
+
watch(
|
1143
|
+
show,
|
1144
|
+
(value) => {
|
1145
|
+
if (value) {
|
1146
|
+
inited.value = value;
|
1147
|
+
}
|
1148
|
+
},
|
1149
|
+
{ immediate: true }
|
1150
|
+
);
|
1134
1151
|
return (render) => () => inited.value ? render() : null;
|
1135
1152
|
}
|
1136
1153
|
const [name$1n, bem$1j] = createNamespace("overlay");
|
@@ -1149,9 +1166,12 @@ var stdin_default$1u = defineComponent({
|
|
1149
1166
|
setup(props, {
|
1150
1167
|
slots
|
1151
1168
|
}) {
|
1169
|
+
const root = ref();
|
1152
1170
|
const lazyRender = useLazyRender(() => props.show || !props.lazyRender);
|
1153
|
-
const
|
1154
|
-
|
1171
|
+
const onTouchMove = (event) => {
|
1172
|
+
if (props.lockScroll) {
|
1173
|
+
preventDefault(event, true);
|
1174
|
+
}
|
1155
1175
|
};
|
1156
1176
|
const renderOverlay = lazyRender(() => {
|
1157
1177
|
var _a;
|
@@ -1160,11 +1180,14 @@ var stdin_default$1u = defineComponent({
|
|
1160
1180
|
style.animationDuration = `${props.duration}s`;
|
1161
1181
|
}
|
1162
1182
|
return withDirectives(createVNode("div", {
|
1183
|
+
"ref": root,
|
1163
1184
|
"style": style,
|
1164
|
-
"class": [bem$1j(), props.className]
|
1165
|
-
"onTouchmove": props.lockScroll ? preventTouchMove : noop
|
1185
|
+
"class": [bem$1j(), props.className]
|
1166
1186
|
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), [[vShow, props.show]]);
|
1167
1187
|
});
|
1188
|
+
useEventListener("touchmove", onTouchMove, {
|
1189
|
+
target: root
|
1190
|
+
});
|
1168
1191
|
return () => createVNode(Transition, {
|
1169
1192
|
"name": "van-fade",
|
1170
1193
|
"appear": true
|
@@ -1540,6 +1563,7 @@ var stdin_default$1r = defineComponent({
|
|
1540
1563
|
let touchStartTime;
|
1541
1564
|
let momentumOffset;
|
1542
1565
|
let transitionEndTrigger;
|
1566
|
+
const root = ref();
|
1543
1567
|
const wrapper = ref();
|
1544
1568
|
const state = reactive({
|
1545
1569
|
index: props.defaultIndex,
|
@@ -1715,10 +1739,13 @@ var stdin_default$1r = defineComponent({
|
|
1715
1739
|
});
|
1716
1740
|
watch(() => props.initialOptions, setOptions);
|
1717
1741
|
watch(() => props.defaultIndex, (value) => setIndex(value));
|
1742
|
+
useEventListener("touchmove", onTouchMove, {
|
1743
|
+
target: root
|
1744
|
+
});
|
1718
1745
|
return () => createVNode("div", {
|
1746
|
+
"ref": root,
|
1719
1747
|
"class": [bem$1g(), props.className],
|
1720
1748
|
"onTouchstartPassive": onTouchStart,
|
1721
|
-
"onTouchmove": onTouchMove,
|
1722
1749
|
"onTouchend": onTouchEnd,
|
1723
1750
|
"onTouchcancel": onTouchEnd
|
1724
1751
|
}, [createVNode("ul", {
|
@@ -1770,6 +1797,7 @@ var stdin_default$1q = defineComponent({
|
|
1770
1797
|
}
|
1771
1798
|
}
|
1772
1799
|
const hasOptions = ref(false);
|
1800
|
+
const columnsRef = ref();
|
1773
1801
|
const formattedColumns = ref([]);
|
1774
1802
|
const columnsFieldNames = computed(() => {
|
1775
1803
|
const {
|
@@ -2006,14 +2034,17 @@ var stdin_default$1q = defineComponent({
|
|
2006
2034
|
height: `${wrapHeight}px`
|
2007
2035
|
};
|
2008
2036
|
return createVNode("div", {
|
2037
|
+
"ref": columnsRef,
|
2009
2038
|
"class": bem$1f("columns"),
|
2010
|
-
"style": columnsStyle
|
2011
|
-
"onTouchmove": preventDefault
|
2039
|
+
"style": columnsStyle
|
2012
2040
|
}, [renderColumnItems(), renderMask(wrapHeight)]);
|
2013
2041
|
};
|
2014
2042
|
watch(() => props.columns, format2, {
|
2015
2043
|
immediate: true
|
2016
2044
|
});
|
2045
|
+
useEventListener("touchmove", preventDefault, {
|
2046
|
+
target: columnsRef
|
2047
|
+
});
|
2017
2048
|
useExpose({
|
2018
2049
|
confirm,
|
2019
2050
|
getValues,
|
@@ -2691,6 +2722,7 @@ var stdin_default$1m = defineComponent({
|
|
2691
2722
|
validateMessage: ""
|
2692
2723
|
});
|
2693
2724
|
const inputRef = ref();
|
2725
|
+
const clearIconRef = ref();
|
2694
2726
|
const customValue = ref();
|
2695
2727
|
const {
|
2696
2728
|
parent: form
|
@@ -3006,9 +3038,9 @@ var stdin_default$1m = defineComponent({
|
|
3006
3038
|
const renderFieldBody = () => [createVNode("div", {
|
3007
3039
|
"class": bem$1b("body")
|
3008
3040
|
}, [renderInput(), showClear.value && createVNode(Icon, {
|
3041
|
+
"ref": clearIconRef,
|
3009
3042
|
"name": props.clearIcon,
|
3010
|
-
"class": bem$1b("clear")
|
3011
|
-
"onTouchstart": onClear
|
3043
|
+
"class": bem$1b("clear")
|
3012
3044
|
}, null), renderRightIcon(), slots.button && createVNode("div", {
|
3013
3045
|
"class": bem$1b("button")
|
3014
3046
|
}, [slots.button()])]), renderWordLimit(), renderMessage()];
|
@@ -3035,6 +3067,12 @@ var stdin_default$1m = defineComponent({
|
|
3035
3067
|
updateValue(getModelValue(), props.formatTrigger);
|
3036
3068
|
nextTick(adjustTextareaSize);
|
3037
3069
|
});
|
3070
|
+
useEventListener("touchstart", onClear, {
|
3071
|
+
target: computed(() => {
|
3072
|
+
var _a;
|
3073
|
+
return (_a = clearIconRef.value) == null ? void 0 : _a.$el;
|
3074
|
+
})
|
3075
|
+
});
|
3038
3076
|
return () => {
|
3039
3077
|
const disabled = getProp("disabled");
|
3040
3078
|
const labelAlign = getProp("labelAlign");
|
@@ -4755,7 +4793,8 @@ var stdin_default$18 = defineComponent({
|
|
4755
4793
|
const {
|
4756
4794
|
type,
|
4757
4795
|
minDate,
|
4758
|
-
maxDate
|
4796
|
+
maxDate,
|
4797
|
+
allowSameDay
|
4759
4798
|
} = props;
|
4760
4799
|
if (defaultDate === null) {
|
4761
4800
|
return defaultDate;
|
@@ -4765,8 +4804,8 @@ var stdin_default$18 = defineComponent({
|
|
4765
4804
|
if (!Array.isArray(defaultDate)) {
|
4766
4805
|
defaultDate = [];
|
4767
4806
|
}
|
4768
|
-
const start = limitDateRange(defaultDate[0] || now, minDate, getPrevDay(maxDate));
|
4769
|
-
const end = limitDateRange(defaultDate[1] || now, getNextDay(minDate));
|
4807
|
+
const start = limitDateRange(defaultDate[0] || now, minDate, allowSameDay ? maxDate : getPrevDay(maxDate));
|
4808
|
+
const end = limitDateRange(defaultDate[1] || now, allowSameDay ? minDate : getNextDay(minDate));
|
4770
4809
|
return [start, end];
|
4771
4810
|
}
|
4772
4811
|
if (type === "multiple") {
|
@@ -5085,6 +5124,7 @@ const imageProps = {
|
|
5085
5124
|
fit: String,
|
5086
5125
|
position: String,
|
5087
5126
|
round: Boolean,
|
5127
|
+
block: Boolean,
|
5088
5128
|
width: numericProp,
|
5089
5129
|
height: numericProp,
|
5090
5130
|
radius: numericProp,
|
@@ -5213,7 +5253,8 @@ var stdin_default$17 = defineComponent({
|
|
5213
5253
|
var _a;
|
5214
5254
|
return createVNode("div", {
|
5215
5255
|
"class": bem$10({
|
5216
|
-
round: props.round
|
5256
|
+
round: props.round,
|
5257
|
+
block: props.block
|
5217
5258
|
}),
|
5218
5259
|
"style": style.value
|
5219
5260
|
}, [renderImage(), renderPlaceholder(), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
@@ -5375,9 +5416,12 @@ function useVisibilityChange(target, onChange) {
|
|
5375
5416
|
if (!inBrowser || !window.IntersectionObserver) {
|
5376
5417
|
return;
|
5377
5418
|
}
|
5378
|
-
const observer = new IntersectionObserver(
|
5379
|
-
|
5380
|
-
|
5419
|
+
const observer = new IntersectionObserver(
|
5420
|
+
(entries) => {
|
5421
|
+
onChange(entries[0].intersectionRatio > 0);
|
5422
|
+
},
|
5423
|
+
{ root: document.body }
|
5424
|
+
);
|
5381
5425
|
const observe = () => {
|
5382
5426
|
if (target.value) {
|
5383
5427
|
observer.observe(target.value);
|
@@ -5613,6 +5657,7 @@ var stdin_default$13 = defineComponent({
|
|
5613
5657
|
slots
|
5614
5658
|
}) {
|
5615
5659
|
const root = ref();
|
5660
|
+
const track = ref();
|
5616
5661
|
const state = reactive({
|
5617
5662
|
rect: null,
|
5618
5663
|
width: 0,
|
@@ -5799,10 +5844,13 @@ var stdin_default$13 = defineComponent({
|
|
5799
5844
|
if (props.touchable && state.swiping) {
|
5800
5845
|
touch.move(event);
|
5801
5846
|
if (isCorrectDirection.value) {
|
5802
|
-
|
5803
|
-
|
5804
|
-
|
5805
|
-
|
5847
|
+
const isEdgeTouch = !props.loop && (state.active === 0 && delta.value > 0 || state.active === count.value - 1 && delta.value < 0);
|
5848
|
+
if (!isEdgeTouch) {
|
5849
|
+
preventDefault(event, props.stopPropagation);
|
5850
|
+
move({
|
5851
|
+
offset: delta.value
|
5852
|
+
});
|
5853
|
+
}
|
5806
5854
|
}
|
5807
5855
|
}
|
5808
5856
|
};
|
@@ -5912,18 +5960,21 @@ var stdin_default$13 = defineComponent({
|
|
5912
5960
|
onPopupReopen(() => initialize(state.active));
|
5913
5961
|
onDeactivated(stopAutoplay);
|
5914
5962
|
onBeforeUnmount(stopAutoplay);
|
5963
|
+
useEventListener("touchmove", onTouchMove, {
|
5964
|
+
target: track
|
5965
|
+
});
|
5915
5966
|
return () => {
|
5916
5967
|
var _a;
|
5917
5968
|
return createVNode("div", {
|
5918
5969
|
"ref": root,
|
5919
5970
|
"class": bem$Y()
|
5920
5971
|
}, [createVNode("div", {
|
5972
|
+
"ref": track,
|
5921
5973
|
"style": trackStyle.value,
|
5922
5974
|
"class": bem$Y("track", {
|
5923
5975
|
vertical: props.vertical
|
5924
5976
|
}),
|
5925
5977
|
"onTouchstartPassive": onTouchStart,
|
5926
|
-
"onTouchmove": onTouchMove,
|
5927
5978
|
"onTouchend": onTouchEnd,
|
5928
5979
|
"onTouchcancel": onTouchEnd
|
5929
5980
|
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), renderIndicator()]);
|
@@ -6123,7 +6174,7 @@ var stdin_default$11 = defineComponent({
|
|
6123
6174
|
index += diff;
|
6124
6175
|
}
|
6125
6176
|
};
|
6126
|
-
const setCurrentIndex = (currentIndex) => {
|
6177
|
+
const setCurrentIndex = (currentIndex, skipScrollIntoView) => {
|
6127
6178
|
const newIndex = findAvailableTab(currentIndex);
|
6128
6179
|
if (!isDef(newIndex)) {
|
6129
6180
|
return;
|
@@ -6138,11 +6189,18 @@ var stdin_default$11 = defineComponent({
|
|
6138
6189
|
emit("change", newName, newTab.title);
|
6139
6190
|
}
|
6140
6191
|
}
|
6192
|
+
if (!skipScrollIntoView) {
|
6193
|
+
scrollIntoView();
|
6194
|
+
}
|
6195
|
+
setLine();
|
6196
|
+
if (stickyFixed && !props.scrollspy) {
|
6197
|
+
setRootScrollTop(Math.ceil(getElementTop(root.value) - offsetTopPx.value));
|
6198
|
+
}
|
6141
6199
|
};
|
6142
|
-
const setCurrentIndexByName = (name2) => {
|
6200
|
+
const setCurrentIndexByName = (name2, skipScrollIntoView) => {
|
6143
6201
|
const matched = children.find((tab, index2) => getTabName(tab, index2) === name2);
|
6144
6202
|
const index = matched ? children.indexOf(matched) : 0;
|
6145
|
-
setCurrentIndex(index);
|
6203
|
+
setCurrentIndex(index, skipScrollIntoView);
|
6146
6204
|
};
|
6147
6205
|
const scrollToCurrentContent = (immediate = false) => {
|
6148
6206
|
if (props.scrollspy) {
|
@@ -6272,15 +6330,8 @@ var stdin_default$11 = defineComponent({
|
|
6272
6330
|
});
|
6273
6331
|
}
|
6274
6332
|
});
|
6275
|
-
watch(() => state.currentIndex, () => {
|
6276
|
-
scrollIntoView();
|
6277
|
-
setLine();
|
6278
|
-
if (stickyFixed && !props.scrollspy) {
|
6279
|
-
setRootScrollTop(Math.ceil(getElementTop(root.value) - offsetTopPx.value));
|
6280
|
-
}
|
6281
|
-
});
|
6282
6333
|
const init = () => {
|
6283
|
-
setCurrentIndexByName(props.active);
|
6334
|
+
setCurrentIndexByName(props.active, true);
|
6284
6335
|
nextTick(() => {
|
6285
6336
|
state.inited = true;
|
6286
6337
|
if (wrapRef.value) {
|
@@ -6473,6 +6524,16 @@ var stdin_default$$ = defineComponent({
|
|
6473
6524
|
}
|
6474
6525
|
return isActive;
|
6475
6526
|
});
|
6527
|
+
const hasInactiveClass = ref(!active.value);
|
6528
|
+
watch(active, (val) => {
|
6529
|
+
if (val) {
|
6530
|
+
hasInactiveClass.value = false;
|
6531
|
+
} else {
|
6532
|
+
doubleRaf(() => {
|
6533
|
+
hasInactiveClass.value = true;
|
6534
|
+
});
|
6535
|
+
}
|
6536
|
+
});
|
6476
6537
|
watch(() => props.title, () => {
|
6477
6538
|
parent.setLine();
|
6478
6539
|
parent.scrollIntoView();
|
@@ -6496,7 +6557,7 @@ var stdin_default$$ = defineComponent({
|
|
6496
6557
|
"id": id,
|
6497
6558
|
"role": "tabpanel",
|
6498
6559
|
"class": bem$U("panel-wrapper", {
|
6499
|
-
inactive:
|
6560
|
+
inactive: hasInactiveClass.value
|
6500
6561
|
}),
|
6501
6562
|
"tabindex": active.value ? 0 : -1,
|
6502
6563
|
"aria-hidden": !active.value,
|
@@ -7736,7 +7797,9 @@ var stdin_default$O = defineComponent({
|
|
7736
7797
|
const CountDown = withInstall(stdin_default$O);
|
7737
7798
|
function getDate(timeStamp) {
|
7738
7799
|
const date = new Date(timeStamp * 1e3);
|
7739
|
-
return `${date.getFullYear()}.${padZero(date.getMonth() + 1)}.${padZero(
|
7800
|
+
return `${date.getFullYear()}.${padZero(date.getMonth() + 1)}.${padZero(
|
7801
|
+
date.getDate()
|
7802
|
+
)}`;
|
7740
7803
|
}
|
7741
7804
|
const formatDiscount = (discount) => (discount / 10).toFixed(discount % 10 === 0 ? 0 : 1);
|
7742
7805
|
const formatAmount = (amount) => (amount / 100).toFixed(amount % 100 === 0 ? 0 : amount % 10 === 0 ? 1 : 2);
|
@@ -9541,6 +9604,7 @@ var stdin_default$A = defineComponent({
|
|
9541
9604
|
displayHeight: 0
|
9542
9605
|
});
|
9543
9606
|
const touch = useTouch();
|
9607
|
+
const swipeItem = ref();
|
9544
9608
|
const vertical = computed(() => {
|
9545
9609
|
const {
|
9546
9610
|
rootWidth,
|
@@ -9726,6 +9790,12 @@ var stdin_default$A = defineComponent({
|
|
9726
9790
|
resetScale();
|
9727
9791
|
}
|
9728
9792
|
});
|
9793
|
+
useEventListener("touchmove", onTouchMove, {
|
9794
|
+
target: computed(() => {
|
9795
|
+
var _a;
|
9796
|
+
return (_a = swipeItem.value) == null ? void 0 : _a.$el;
|
9797
|
+
})
|
9798
|
+
});
|
9729
9799
|
return () => {
|
9730
9800
|
const imageSlots = {
|
9731
9801
|
loading: () => createVNode(Loading, {
|
@@ -9733,9 +9803,9 @@ var stdin_default$A = defineComponent({
|
|
9733
9803
|
}, null)
|
9734
9804
|
};
|
9735
9805
|
return createVNode(SwipeItem, {
|
9806
|
+
"ref": swipeItem,
|
9736
9807
|
"class": bem$v("swipe-item"),
|
9737
9808
|
"onTouchstartPassive": onTouchStart,
|
9738
|
-
"onTouchmove": onTouchMove,
|
9739
9809
|
"onTouchend": onTouchEnd,
|
9740
9810
|
"onTouchcancel": onTouchEnd
|
9741
9811
|
}, {
|
@@ -9989,6 +10059,7 @@ var stdin_default$y = defineComponent({
|
|
9989
10059
|
slots
|
9990
10060
|
}) {
|
9991
10061
|
const root = ref();
|
10062
|
+
const sidebar = ref();
|
9992
10063
|
const activeAnchor = ref("");
|
9993
10064
|
const touch = useTouch();
|
9994
10065
|
const scrollParent = useScrollParent(root);
|
@@ -10108,11 +10179,11 @@ var stdin_default$y = defineComponent({
|
|
10108
10179
|
const {
|
10109
10180
|
offsetHeight
|
10110
10181
|
} = document.documentElement;
|
10182
|
+
match.$el.scrollIntoView();
|
10111
10183
|
if (scrollTop === offsetHeight - scrollParentRect.height) {
|
10112
10184
|
onScroll();
|
10113
10185
|
return;
|
10114
10186
|
}
|
10115
|
-
match.$el.scrollIntoView();
|
10116
10187
|
if (props.sticky && props.stickyOffsetTop) {
|
10117
10188
|
setRootScrollTop(getRootScrollTop() - props.stickyOffsetTop);
|
10118
10189
|
}
|
@@ -10152,15 +10223,18 @@ var stdin_default$y = defineComponent({
|
|
10152
10223
|
}
|
10153
10224
|
};
|
10154
10225
|
const renderSidebar = () => createVNode("div", {
|
10226
|
+
"ref": sidebar,
|
10155
10227
|
"class": bem$t("sidebar"),
|
10156
10228
|
"style": sidebarStyle.value,
|
10157
10229
|
"onClick": onClickSidebar,
|
10158
|
-
"onTouchstartPassive": touch.start
|
10159
|
-
"onTouchmove": onTouchMove
|
10230
|
+
"onTouchstartPassive": touch.start
|
10160
10231
|
}, [renderIndexes()]);
|
10161
10232
|
useExpose({
|
10162
10233
|
scrollTo
|
10163
10234
|
});
|
10235
|
+
useEventListener("touchmove", onTouchMove, {
|
10236
|
+
target: sidebar
|
10237
|
+
});
|
10164
10238
|
return () => {
|
10165
10239
|
var _a;
|
10166
10240
|
return createVNode("div", {
|
@@ -11859,6 +11933,9 @@ var stdin_default$l = defineComponent({
|
|
11859
11933
|
}, null)]);
|
11860
11934
|
};
|
11861
11935
|
useCustomFieldValue(() => props.modelValue);
|
11936
|
+
useEventListener("touchmove", onTouchMove, {
|
11937
|
+
target: groupRef
|
11938
|
+
});
|
11862
11939
|
return () => createVNode("div", {
|
11863
11940
|
"ref": groupRef,
|
11864
11941
|
"role": "radiogroup",
|
@@ -11869,8 +11946,7 @@ var stdin_default$l = defineComponent({
|
|
11869
11946
|
"tabindex": props.disabled ? void 0 : 0,
|
11870
11947
|
"aria-disabled": props.disabled,
|
11871
11948
|
"aria-readonly": props.readonly,
|
11872
|
-
"onTouchstartPassive": onTouchStart
|
11873
|
-
"onTouchmove": onTouchMove
|
11949
|
+
"onTouchstartPassive": onTouchStart
|
11874
11950
|
}, [list.value.map(renderStar)]);
|
11875
11951
|
}
|
11876
11952
|
});
|
@@ -12309,6 +12385,7 @@ var stdin_default$f = defineComponent({
|
|
12309
12385
|
let current2;
|
12310
12386
|
let startValue;
|
12311
12387
|
const root = ref();
|
12388
|
+
const slider = ref();
|
12312
12389
|
const dragStatus = ref();
|
12313
12390
|
const touch = useTouch();
|
12314
12391
|
const scope = computed(() => Number(props.max) - Number(props.min));
|
@@ -12501,6 +12578,7 @@ var stdin_default$f = defineComponent({
|
|
12501
12578
|
const renderButton = (index) => {
|
12502
12579
|
const current22 = typeof index === "number" ? props.modelValue[index] : props.modelValue;
|
12503
12580
|
return createVNode("div", {
|
12581
|
+
"ref": slider,
|
12504
12582
|
"role": "slider",
|
12505
12583
|
"class": getButtonClassName(index),
|
12506
12584
|
"tabindex": props.disabled ? void 0 : 0,
|
@@ -12516,7 +12594,6 @@ var stdin_default$f = defineComponent({
|
|
12516
12594
|
}
|
12517
12595
|
onTouchStart(event);
|
12518
12596
|
},
|
12519
|
-
"onTouchmove": onTouchMove,
|
12520
12597
|
"onTouchend": onTouchEnd,
|
12521
12598
|
"onTouchcancel": onTouchEnd,
|
12522
12599
|
"onClick": stopPropagation
|
@@ -12524,6 +12601,9 @@ var stdin_default$f = defineComponent({
|
|
12524
12601
|
};
|
12525
12602
|
updateValue(props.modelValue);
|
12526
12603
|
useCustomFieldValue(() => props.modelValue);
|
12604
|
+
useEventListener("touchmove", onTouchMove, {
|
12605
|
+
target: slider
|
12606
|
+
});
|
12527
12607
|
return () => createVNode("div", {
|
12528
12608
|
"ref": root,
|
12529
12609
|
"style": wrapperStyle.value,
|
@@ -13248,6 +13328,9 @@ var stdin_default$9 = defineComponent({
|
|
13248
13328
|
useClickAway(root, () => onClick("outside"), {
|
13249
13329
|
eventName: "touchstart"
|
13250
13330
|
});
|
13331
|
+
useEventListener("touchmove", onTouchMove, {
|
13332
|
+
target: root
|
13333
|
+
});
|
13251
13334
|
return () => {
|
13252
13335
|
var _a;
|
13253
13336
|
const wrapperStyle = {
|
@@ -13259,7 +13342,6 @@ var stdin_default$9 = defineComponent({
|
|
13259
13342
|
"class": bem$4(),
|
13260
13343
|
"onClick": getClickHandler("cell", lockClick2),
|
13261
13344
|
"onTouchstartPassive": onTouchStart,
|
13262
|
-
"onTouchmove": onTouchMove,
|
13263
13345
|
"onTouchend": onTouchEnd,
|
13264
13346
|
"onTouchcancel": onTouchEnd
|
13265
13347
|
}, [createVNode("div", {
|
@@ -13993,7 +14075,10 @@ function getBestSelectionFromSrcset(el, scale) {
|
|
13993
14075
|
tmpWidth = 999998;
|
13994
14076
|
} else {
|
13995
14077
|
tmpSrc = item.substr(0, spaceIndex);
|
13996
|
-
tmpWidth = parseInt(
|
14078
|
+
tmpWidth = parseInt(
|
14079
|
+
item.substr(spaceIndex + 1, item.length - spaceIndex - 2),
|
14080
|
+
10
|
14081
|
+
);
|
13997
14082
|
}
|
13998
14083
|
return [tmpWidth, tmpSrc];
|
13999
14084
|
});
|
@@ -14184,24 +14269,32 @@ class ReactiveListener {
|
|
14184
14269
|
}
|
14185
14270
|
renderLoading(cb) {
|
14186
14271
|
this.state.loading = true;
|
14187
|
-
loadImageAsync(
|
14188
|
-
|
14189
|
-
|
14190
|
-
|
14191
|
-
|
14192
|
-
|
14193
|
-
|
14194
|
-
|
14195
|
-
|
14196
|
-
|
14197
|
-
|
14198
|
-
|
14199
|
-
|
14272
|
+
loadImageAsync(
|
14273
|
+
{
|
14274
|
+
src: this.loading,
|
14275
|
+
cors: this.cors
|
14276
|
+
},
|
14277
|
+
() => {
|
14278
|
+
this.render("loading", false);
|
14279
|
+
this.state.loading = false;
|
14280
|
+
cb();
|
14281
|
+
},
|
14282
|
+
() => {
|
14283
|
+
cb();
|
14284
|
+
this.state.loading = false;
|
14285
|
+
if (process.env.NODE_ENV !== "production" && !this.options.silent)
|
14286
|
+
console.warn(
|
14287
|
+
`[@vant/lazyload] load failed with loading image(${this.loading})`
|
14288
|
+
);
|
14289
|
+
}
|
14290
|
+
);
|
14200
14291
|
}
|
14201
14292
|
load(onFinish = noop) {
|
14202
14293
|
if (this.attempt > this.options.attempt - 1 && this.state.error) {
|
14203
14294
|
if (process.env.NODE_ENV !== "production" && !this.options.silent) {
|
14204
|
-
console.log(
|
14295
|
+
console.log(
|
14296
|
+
`[@vant/lazyload] ${this.src} tried too more than ${this.options.attempt} times`
|
14297
|
+
);
|
14205
14298
|
}
|
14206
14299
|
onFinish();
|
14207
14300
|
return;
|
@@ -14219,25 +14312,29 @@ class ReactiveListener {
|
|
14219
14312
|
this.attempt++;
|
14220
14313
|
(_b = (_a = this.options.adapter).beforeLoad) == null ? void 0 : _b.call(_a, this, this.options);
|
14221
14314
|
this.record("loadStart");
|
14222
|
-
loadImageAsync(
|
14223
|
-
|
14224
|
-
|
14225
|
-
|
14226
|
-
|
14227
|
-
|
14228
|
-
|
14229
|
-
|
14230
|
-
|
14231
|
-
|
14232
|
-
|
14233
|
-
|
14234
|
-
|
14235
|
-
|
14236
|
-
|
14237
|
-
|
14238
|
-
|
14239
|
-
|
14240
|
-
|
14315
|
+
loadImageAsync(
|
14316
|
+
{
|
14317
|
+
src: this.src,
|
14318
|
+
cors: this.cors
|
14319
|
+
},
|
14320
|
+
(data) => {
|
14321
|
+
this.naturalHeight = data.naturalHeight;
|
14322
|
+
this.naturalWidth = data.naturalWidth;
|
14323
|
+
this.state.loaded = true;
|
14324
|
+
this.state.error = false;
|
14325
|
+
this.record("loadEnd");
|
14326
|
+
this.render("loaded", false);
|
14327
|
+
this.state.rendered = true;
|
14328
|
+
this.imageCache.add(this.src);
|
14329
|
+
onFinish();
|
14330
|
+
},
|
14331
|
+
(err) => {
|
14332
|
+
!this.options.silent && console.error(err);
|
14333
|
+
this.state.error = true;
|
14334
|
+
this.state.loaded = false;
|
14335
|
+
this.render("error", false);
|
14336
|
+
}
|
14337
|
+
);
|
14241
14338
|
});
|
14242
14339
|
}
|
14243
14340
|
render(state, cache) {
|
@@ -14322,7 +14419,10 @@ function stdin_default$3() {
|
|
14322
14419
|
};
|
14323
14420
|
this.initEvent();
|
14324
14421
|
this.imageCache = new ImageCache({ max: 200 });
|
14325
|
-
this.lazyLoadHandler = throttle(
|
14422
|
+
this.lazyLoadHandler = throttle(
|
14423
|
+
this.lazyLoadHandler.bind(this),
|
14424
|
+
this.options.throttleWait
|
14425
|
+
);
|
14326
14426
|
this.setMode(this.options.observer ? modeType.observer : modeType.event);
|
14327
14427
|
}
|
14328
14428
|
config(options = {}) {
|
@@ -14477,7 +14577,9 @@ function stdin_default$3() {
|
|
14477
14577
|
});
|
14478
14578
|
}
|
14479
14579
|
initListen(el, start) {
|
14480
|
-
this.options.ListenEvents.forEach(
|
14580
|
+
this.options.ListenEvents.forEach(
|
14581
|
+
(evt) => (start ? on : off)(el, evt, this.lazyLoadHandler)
|
14582
|
+
);
|
14481
14583
|
}
|
14482
14584
|
initEvent() {
|
14483
14585
|
this.Event = {
|
@@ -14534,7 +14636,10 @@ function stdin_default$3() {
|
|
14534
14636
|
if (!hasIntersectionObserver) {
|
14535
14637
|
return;
|
14536
14638
|
}
|
14537
|
-
this.observer = new IntersectionObserver(
|
14639
|
+
this.observer = new IntersectionObserver(
|
14640
|
+
this.observerHandler.bind(this),
|
14641
|
+
this.options.observerOptions
|
14642
|
+
);
|
14538
14643
|
if (this.listeners.length) {
|
14539
14644
|
this.listeners.forEach((listener) => {
|
14540
14645
|
this.observer.observe(listener.el);
|
@@ -14613,7 +14718,10 @@ var stdin_default$2 = (lazy) => ({
|
|
14613
14718
|
},
|
14614
14719
|
emits: ["show"],
|
14615
14720
|
render() {
|
14616
|
-
return h(
|
14721
|
+
return h(
|
14722
|
+
this.tag,
|
14723
|
+
this.show && this.$slots.default ? this.$slots.default() : null
|
14724
|
+
);
|
14617
14725
|
},
|
14618
14726
|
data() {
|
14619
14727
|
return {
|
@@ -14665,13 +14773,17 @@ class LazyContainer {
|
|
14665
14773
|
this.options = Object.assign({}, defaultOptions, binding.value);
|
14666
14774
|
const imgs = this.getImgs();
|
14667
14775
|
imgs.forEach((el2) => {
|
14668
|
-
this.lazy.add(
|
14669
|
-
|
14670
|
-
|
14671
|
-
|
14672
|
-
|
14673
|
-
|
14674
|
-
|
14776
|
+
this.lazy.add(
|
14777
|
+
el2,
|
14778
|
+
Object.assign({}, this.binding, {
|
14779
|
+
value: {
|
14780
|
+
src: "dataset" in el2 ? el2.dataset.src : el2.getAttribute("data-src"),
|
14781
|
+
error: ("dataset" in el2 ? el2.dataset.error : el2.getAttribute("data-error")) || this.options.error,
|
14782
|
+
loading: ("dataset" in el2 ? el2.dataset.loading : el2.getAttribute("data-loading")) || this.options.loading
|
14783
|
+
}
|
14784
|
+
}),
|
14785
|
+
this.vnode
|
14786
|
+
);
|
14675
14787
|
});
|
14676
14788
|
}
|
14677
14789
|
getImgs() {
|
@@ -14722,11 +14834,15 @@ var stdin_default$1 = (lazyManager) => ({
|
|
14722
14834
|
}
|
14723
14835
|
},
|
14724
14836
|
render(h2) {
|
14725
|
-
return h2(
|
14726
|
-
|
14727
|
-
|
14728
|
-
|
14729
|
-
|
14837
|
+
return h2(
|
14838
|
+
this.tag,
|
14839
|
+
{
|
14840
|
+
attrs: {
|
14841
|
+
src: this.renderSrc
|
14842
|
+
}
|
14843
|
+
},
|
14844
|
+
this.$slots.default
|
14845
|
+
);
|
14730
14846
|
},
|
14731
14847
|
data() {
|
14732
14848
|
return {
|
@@ -14780,20 +14896,26 @@ var stdin_default$1 = (lazyManager) => ({
|
|
14780
14896
|
load(onFinish = noop) {
|
14781
14897
|
if (this.state.attempt > this.options.attempt - 1 && this.state.error) {
|
14782
14898
|
if (process.env.NODE_ENV !== "production" && !lazyManager.options.silent) {
|
14783
|
-
console.log(
|
14899
|
+
console.log(
|
14900
|
+
`[@vant/lazyload] ${this.options.src} tried too more than ${this.options.attempt} times`
|
14901
|
+
);
|
14784
14902
|
}
|
14785
14903
|
onFinish();
|
14786
14904
|
return;
|
14787
14905
|
}
|
14788
14906
|
const { src } = this.options;
|
14789
|
-
loadImageAsync(
|
14790
|
-
|
14791
|
-
|
14792
|
-
|
14793
|
-
|
14794
|
-
|
14795
|
-
|
14796
|
-
|
14907
|
+
loadImageAsync(
|
14908
|
+
{ src },
|
14909
|
+
({ src: src2 }) => {
|
14910
|
+
this.renderSrc = src2;
|
14911
|
+
this.state.loaded = true;
|
14912
|
+
},
|
14913
|
+
() => {
|
14914
|
+
this.state.attempt++;
|
14915
|
+
this.renderSrc = this.options.error;
|
14916
|
+
this.state.error = true;
|
14917
|
+
}
|
14918
|
+
);
|
14797
14919
|
}
|
14798
14920
|
}
|
14799
14921
|
});
|
@@ -14821,7 +14943,7 @@ const Lazyload = {
|
|
14821
14943
|
});
|
14822
14944
|
}
|
14823
14945
|
};
|
14824
|
-
const version = "3.6.
|
14946
|
+
const version = "3.6.3";
|
14825
14947
|
function install(app) {
|
14826
14948
|
const components = [
|
14827
14949
|
ActionBar,
|