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.cjs.js
CHANGED
@@ -3,6 +3,17 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
3
3
|
const use = require("@vant/use");
|
4
4
|
const vue = require("vue");
|
5
5
|
const popperjs = require("@vant/popperjs");
|
6
|
+
const isDef = (val) => val !== void 0 && val !== null;
|
7
|
+
const isFunction = (val) => typeof val === "function";
|
8
|
+
const isObject = (val) => val !== null && typeof val === "object";
|
9
|
+
const isPromise = (val) => isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
10
|
+
const isDate = (val) => Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
|
11
|
+
function isMobile(value) {
|
12
|
+
value = value.replace(/[^-|\d]/g, "");
|
13
|
+
return /^((\+86)|(86))?(1)\d{10}$/.test(value) || /^0[0-9-]{10,13}$/.test(value);
|
14
|
+
}
|
15
|
+
const isNumeric = (val) => typeof val === "number" || /^\d+(\.\d+)?$/.test(val);
|
16
|
+
const isIOS$1 = () => inBrowser ? /ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase()) : false;
|
6
17
|
function noop() {
|
7
18
|
}
|
8
19
|
const extend = Object.assign;
|
@@ -12,7 +23,7 @@ function get(object, path) {
|
|
12
23
|
let result = object;
|
13
24
|
keys.forEach((key) => {
|
14
25
|
var _a;
|
15
|
-
result = (_a = result[key]) != null ? _a : "";
|
26
|
+
result = isObject(result) ? (_a = result[key]) != null ? _a : "" : "";
|
16
27
|
});
|
17
28
|
return result;
|
18
29
|
}
|
@@ -51,17 +62,6 @@ const makeStringProp = (defaultVal) => ({
|
|
51
62
|
type: String,
|
52
63
|
default: defaultVal
|
53
64
|
});
|
54
|
-
const isDef = (val) => val !== void 0 && val !== null;
|
55
|
-
const isFunction = (val) => typeof val === "function";
|
56
|
-
const isObject = (val) => val !== null && typeof val === "object";
|
57
|
-
const isPromise = (val) => isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
58
|
-
const isDate = (val) => Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
|
59
|
-
function isMobile(value) {
|
60
|
-
value = value.replace(/[^-|\d]/g, "");
|
61
|
-
return /^((\+86)|(86))?(1)\d{10}$/.test(value) || /^0[0-9-]{10,13}$/.test(value);
|
62
|
-
}
|
63
|
-
const isNumeric = (val) => typeof val === "number" || /^\d+(\.\d+)?$/.test(val);
|
64
|
-
const isIOS$1 = () => inBrowser ? /ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase()) : false;
|
65
65
|
function getScrollTop(el) {
|
66
66
|
const top = "scrollTop" in el ? el.scrollTop : el.pageYOffset;
|
67
67
|
return Math.max(top, 0);
|
@@ -332,9 +332,15 @@ function genBem(name2, mods) {
|
|
332
332
|
return ` ${name2}--${mods}`;
|
333
333
|
}
|
334
334
|
if (Array.isArray(mods)) {
|
335
|
-
return mods.reduce(
|
336
|
-
|
337
|
-
|
335
|
+
return mods.reduce(
|
336
|
+
(ret, item) => ret + genBem(name2, item),
|
337
|
+
""
|
338
|
+
);
|
339
|
+
}
|
340
|
+
return Object.keys(mods).reduce(
|
341
|
+
(ret, key) => ret + (mods[key] ? genBem(name2, key) : ""),
|
342
|
+
""
|
343
|
+
);
|
338
344
|
}
|
339
345
|
function createBEM(name2) {
|
340
346
|
return (el, mods) => {
|
@@ -390,8 +396,10 @@ function callInterceptor(interceptor, {
|
|
390
396
|
function withInstall(options) {
|
391
397
|
options.install = (app) => {
|
392
398
|
const { name: name2 } = options;
|
393
|
-
|
394
|
-
|
399
|
+
if (name2) {
|
400
|
+
app.component(name2, options);
|
401
|
+
app.component(camelize(`-${name2}`), options);
|
402
|
+
}
|
395
403
|
};
|
396
404
|
return options;
|
397
405
|
}
|
@@ -1020,7 +1028,9 @@ const popupSharedProps = {
|
|
1020
1028
|
transitionAppear: Boolean,
|
1021
1029
|
closeOnClickOverlay: truthProp
|
1022
1030
|
};
|
1023
|
-
const popupSharedPropKeys = Object.keys(
|
1031
|
+
const popupSharedPropKeys = Object.keys(
|
1032
|
+
popupSharedProps
|
1033
|
+
);
|
1024
1034
|
function getDirection(x, y) {
|
1025
1035
|
if (x > y) {
|
1026
1036
|
return "horizontal";
|
@@ -1087,7 +1097,10 @@ function useLockScroll(rootRef, shouldLock) {
|
|
1087
1097
|
const onTouchMove = (event) => {
|
1088
1098
|
touch.move(event);
|
1089
1099
|
const direction = touch.deltaY.value > 0 ? DIRECTION_DOWN : DIRECTION_UP;
|
1090
|
-
const el = use.getScrollParent(
|
1100
|
+
const el = use.getScrollParent(
|
1101
|
+
event.target,
|
1102
|
+
rootRef.value
|
1103
|
+
);
|
1091
1104
|
const { scrollHeight, offsetHeight, scrollTop } = el;
|
1092
1105
|
let status = "11";
|
1093
1106
|
if (scrollTop === 0) {
|
@@ -1128,11 +1141,15 @@ function useLockScroll(rootRef, shouldLock) {
|
|
1128
1141
|
}
|
1129
1142
|
function useLazyRender(show) {
|
1130
1143
|
const inited = vue.ref(false);
|
1131
|
-
vue.watch(
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1144
|
+
vue.watch(
|
1145
|
+
show,
|
1146
|
+
(value) => {
|
1147
|
+
if (value) {
|
1148
|
+
inited.value = value;
|
1149
|
+
}
|
1150
|
+
},
|
1151
|
+
{ immediate: true }
|
1152
|
+
);
|
1136
1153
|
return (render) => () => inited.value ? render() : null;
|
1137
1154
|
}
|
1138
1155
|
const [name$1n, bem$1j] = createNamespace("overlay");
|
@@ -1151,9 +1168,12 @@ var stdin_default$1u = vue.defineComponent({
|
|
1151
1168
|
setup(props, {
|
1152
1169
|
slots
|
1153
1170
|
}) {
|
1171
|
+
const root = vue.ref();
|
1154
1172
|
const lazyRender = useLazyRender(() => props.show || !props.lazyRender);
|
1155
|
-
const
|
1156
|
-
|
1173
|
+
const onTouchMove = (event) => {
|
1174
|
+
if (props.lockScroll) {
|
1175
|
+
preventDefault(event, true);
|
1176
|
+
}
|
1157
1177
|
};
|
1158
1178
|
const renderOverlay = lazyRender(() => {
|
1159
1179
|
var _a;
|
@@ -1162,11 +1182,14 @@ var stdin_default$1u = vue.defineComponent({
|
|
1162
1182
|
style.animationDuration = `${props.duration}s`;
|
1163
1183
|
}
|
1164
1184
|
return vue.withDirectives(vue.createVNode("div", {
|
1185
|
+
"ref": root,
|
1165
1186
|
"style": style,
|
1166
|
-
"class": [bem$1j(), props.className]
|
1167
|
-
"onTouchmove": props.lockScroll ? preventTouchMove : noop
|
1187
|
+
"class": [bem$1j(), props.className]
|
1168
1188
|
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), [[vue.vShow, props.show]]);
|
1169
1189
|
});
|
1190
|
+
use.useEventListener("touchmove", onTouchMove, {
|
1191
|
+
target: root
|
1192
|
+
});
|
1170
1193
|
return () => vue.createVNode(vue.Transition, {
|
1171
1194
|
"name": "van-fade",
|
1172
1195
|
"appear": true
|
@@ -1542,6 +1565,7 @@ var stdin_default$1r = vue.defineComponent({
|
|
1542
1565
|
let touchStartTime;
|
1543
1566
|
let momentumOffset;
|
1544
1567
|
let transitionEndTrigger;
|
1568
|
+
const root = vue.ref();
|
1545
1569
|
const wrapper = vue.ref();
|
1546
1570
|
const state = vue.reactive({
|
1547
1571
|
index: props.defaultIndex,
|
@@ -1717,10 +1741,13 @@ var stdin_default$1r = vue.defineComponent({
|
|
1717
1741
|
});
|
1718
1742
|
vue.watch(() => props.initialOptions, setOptions);
|
1719
1743
|
vue.watch(() => props.defaultIndex, (value) => setIndex(value));
|
1744
|
+
use.useEventListener("touchmove", onTouchMove, {
|
1745
|
+
target: root
|
1746
|
+
});
|
1720
1747
|
return () => vue.createVNode("div", {
|
1748
|
+
"ref": root,
|
1721
1749
|
"class": [bem$1g(), props.className],
|
1722
1750
|
"onTouchstartPassive": onTouchStart,
|
1723
|
-
"onTouchmove": onTouchMove,
|
1724
1751
|
"onTouchend": onTouchEnd,
|
1725
1752
|
"onTouchcancel": onTouchEnd
|
1726
1753
|
}, [vue.createVNode("ul", {
|
@@ -1772,6 +1799,7 @@ var stdin_default$1q = vue.defineComponent({
|
|
1772
1799
|
}
|
1773
1800
|
}
|
1774
1801
|
const hasOptions = vue.ref(false);
|
1802
|
+
const columnsRef = vue.ref();
|
1775
1803
|
const formattedColumns = vue.ref([]);
|
1776
1804
|
const columnsFieldNames = vue.computed(() => {
|
1777
1805
|
const {
|
@@ -2008,14 +2036,17 @@ var stdin_default$1q = vue.defineComponent({
|
|
2008
2036
|
height: `${wrapHeight}px`
|
2009
2037
|
};
|
2010
2038
|
return vue.createVNode("div", {
|
2039
|
+
"ref": columnsRef,
|
2011
2040
|
"class": bem$1f("columns"),
|
2012
|
-
"style": columnsStyle
|
2013
|
-
"onTouchmove": preventDefault
|
2041
|
+
"style": columnsStyle
|
2014
2042
|
}, [renderColumnItems(), renderMask(wrapHeight)]);
|
2015
2043
|
};
|
2016
2044
|
vue.watch(() => props.columns, format2, {
|
2017
2045
|
immediate: true
|
2018
2046
|
});
|
2047
|
+
use.useEventListener("touchmove", preventDefault, {
|
2048
|
+
target: columnsRef
|
2049
|
+
});
|
2019
2050
|
useExpose({
|
2020
2051
|
confirm,
|
2021
2052
|
getValues,
|
@@ -2693,6 +2724,7 @@ var stdin_default$1m = vue.defineComponent({
|
|
2693
2724
|
validateMessage: ""
|
2694
2725
|
});
|
2695
2726
|
const inputRef = vue.ref();
|
2727
|
+
const clearIconRef = vue.ref();
|
2696
2728
|
const customValue = vue.ref();
|
2697
2729
|
const {
|
2698
2730
|
parent: form
|
@@ -3008,9 +3040,9 @@ var stdin_default$1m = vue.defineComponent({
|
|
3008
3040
|
const renderFieldBody = () => [vue.createVNode("div", {
|
3009
3041
|
"class": bem$1b("body")
|
3010
3042
|
}, [renderInput(), showClear.value && vue.createVNode(Icon, {
|
3043
|
+
"ref": clearIconRef,
|
3011
3044
|
"name": props.clearIcon,
|
3012
|
-
"class": bem$1b("clear")
|
3013
|
-
"onTouchstart": onClear
|
3045
|
+
"class": bem$1b("clear")
|
3014
3046
|
}, null), renderRightIcon(), slots.button && vue.createVNode("div", {
|
3015
3047
|
"class": bem$1b("button")
|
3016
3048
|
}, [slots.button()])]), renderWordLimit(), renderMessage()];
|
@@ -3037,6 +3069,12 @@ var stdin_default$1m = vue.defineComponent({
|
|
3037
3069
|
updateValue(getModelValue(), props.formatTrigger);
|
3038
3070
|
vue.nextTick(adjustTextareaSize);
|
3039
3071
|
});
|
3072
|
+
use.useEventListener("touchstart", onClear, {
|
3073
|
+
target: vue.computed(() => {
|
3074
|
+
var _a;
|
3075
|
+
return (_a = clearIconRef.value) == null ? void 0 : _a.$el;
|
3076
|
+
})
|
3077
|
+
});
|
3040
3078
|
return () => {
|
3041
3079
|
const disabled = getProp("disabled");
|
3042
3080
|
const labelAlign = getProp("labelAlign");
|
@@ -4757,7 +4795,8 @@ var stdin_default$18 = vue.defineComponent({
|
|
4757
4795
|
const {
|
4758
4796
|
type,
|
4759
4797
|
minDate,
|
4760
|
-
maxDate
|
4798
|
+
maxDate,
|
4799
|
+
allowSameDay
|
4761
4800
|
} = props;
|
4762
4801
|
if (defaultDate === null) {
|
4763
4802
|
return defaultDate;
|
@@ -4767,8 +4806,8 @@ var stdin_default$18 = vue.defineComponent({
|
|
4767
4806
|
if (!Array.isArray(defaultDate)) {
|
4768
4807
|
defaultDate = [];
|
4769
4808
|
}
|
4770
|
-
const start = limitDateRange(defaultDate[0] || now, minDate, getPrevDay(maxDate));
|
4771
|
-
const end = limitDateRange(defaultDate[1] || now, getNextDay(minDate));
|
4809
|
+
const start = limitDateRange(defaultDate[0] || now, minDate, allowSameDay ? maxDate : getPrevDay(maxDate));
|
4810
|
+
const end = limitDateRange(defaultDate[1] || now, allowSameDay ? minDate : getNextDay(minDate));
|
4772
4811
|
return [start, end];
|
4773
4812
|
}
|
4774
4813
|
if (type === "multiple") {
|
@@ -5087,6 +5126,7 @@ const imageProps = {
|
|
5087
5126
|
fit: String,
|
5088
5127
|
position: String,
|
5089
5128
|
round: Boolean,
|
5129
|
+
block: Boolean,
|
5090
5130
|
width: numericProp,
|
5091
5131
|
height: numericProp,
|
5092
5132
|
radius: numericProp,
|
@@ -5215,7 +5255,8 @@ var stdin_default$17 = vue.defineComponent({
|
|
5215
5255
|
var _a;
|
5216
5256
|
return vue.createVNode("div", {
|
5217
5257
|
"class": bem$10({
|
5218
|
-
round: props.round
|
5258
|
+
round: props.round,
|
5259
|
+
block: props.block
|
5219
5260
|
}),
|
5220
5261
|
"style": style.value
|
5221
5262
|
}, [renderImage(), renderPlaceholder(), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
@@ -5377,9 +5418,12 @@ function useVisibilityChange(target, onChange) {
|
|
5377
5418
|
if (!inBrowser || !window.IntersectionObserver) {
|
5378
5419
|
return;
|
5379
5420
|
}
|
5380
|
-
const observer = new IntersectionObserver(
|
5381
|
-
|
5382
|
-
|
5421
|
+
const observer = new IntersectionObserver(
|
5422
|
+
(entries) => {
|
5423
|
+
onChange(entries[0].intersectionRatio > 0);
|
5424
|
+
},
|
5425
|
+
{ root: document.body }
|
5426
|
+
);
|
5383
5427
|
const observe = () => {
|
5384
5428
|
if (target.value) {
|
5385
5429
|
observer.observe(target.value);
|
@@ -5615,6 +5659,7 @@ var stdin_default$13 = vue.defineComponent({
|
|
5615
5659
|
slots
|
5616
5660
|
}) {
|
5617
5661
|
const root = vue.ref();
|
5662
|
+
const track = vue.ref();
|
5618
5663
|
const state = vue.reactive({
|
5619
5664
|
rect: null,
|
5620
5665
|
width: 0,
|
@@ -5801,10 +5846,13 @@ var stdin_default$13 = vue.defineComponent({
|
|
5801
5846
|
if (props.touchable && state.swiping) {
|
5802
5847
|
touch.move(event);
|
5803
5848
|
if (isCorrectDirection.value) {
|
5804
|
-
|
5805
|
-
|
5806
|
-
|
5807
|
-
|
5849
|
+
const isEdgeTouch = !props.loop && (state.active === 0 && delta.value > 0 || state.active === count.value - 1 && delta.value < 0);
|
5850
|
+
if (!isEdgeTouch) {
|
5851
|
+
preventDefault(event, props.stopPropagation);
|
5852
|
+
move({
|
5853
|
+
offset: delta.value
|
5854
|
+
});
|
5855
|
+
}
|
5808
5856
|
}
|
5809
5857
|
}
|
5810
5858
|
};
|
@@ -5914,18 +5962,21 @@ var stdin_default$13 = vue.defineComponent({
|
|
5914
5962
|
onPopupReopen(() => initialize(state.active));
|
5915
5963
|
vue.onDeactivated(stopAutoplay);
|
5916
5964
|
vue.onBeforeUnmount(stopAutoplay);
|
5965
|
+
use.useEventListener("touchmove", onTouchMove, {
|
5966
|
+
target: track
|
5967
|
+
});
|
5917
5968
|
return () => {
|
5918
5969
|
var _a;
|
5919
5970
|
return vue.createVNode("div", {
|
5920
5971
|
"ref": root,
|
5921
5972
|
"class": bem$Y()
|
5922
5973
|
}, [vue.createVNode("div", {
|
5974
|
+
"ref": track,
|
5923
5975
|
"style": trackStyle.value,
|
5924
5976
|
"class": bem$Y("track", {
|
5925
5977
|
vertical: props.vertical
|
5926
5978
|
}),
|
5927
5979
|
"onTouchstartPassive": onTouchStart,
|
5928
|
-
"onTouchmove": onTouchMove,
|
5929
5980
|
"onTouchend": onTouchEnd,
|
5930
5981
|
"onTouchcancel": onTouchEnd
|
5931
5982
|
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), renderIndicator()]);
|
@@ -6125,7 +6176,7 @@ var stdin_default$11 = vue.defineComponent({
|
|
6125
6176
|
index += diff;
|
6126
6177
|
}
|
6127
6178
|
};
|
6128
|
-
const setCurrentIndex = (currentIndex) => {
|
6179
|
+
const setCurrentIndex = (currentIndex, skipScrollIntoView) => {
|
6129
6180
|
const newIndex = findAvailableTab(currentIndex);
|
6130
6181
|
if (!isDef(newIndex)) {
|
6131
6182
|
return;
|
@@ -6140,11 +6191,18 @@ var stdin_default$11 = vue.defineComponent({
|
|
6140
6191
|
emit("change", newName, newTab.title);
|
6141
6192
|
}
|
6142
6193
|
}
|
6194
|
+
if (!skipScrollIntoView) {
|
6195
|
+
scrollIntoView();
|
6196
|
+
}
|
6197
|
+
setLine();
|
6198
|
+
if (stickyFixed && !props.scrollspy) {
|
6199
|
+
setRootScrollTop(Math.ceil(getElementTop(root.value) - offsetTopPx.value));
|
6200
|
+
}
|
6143
6201
|
};
|
6144
|
-
const setCurrentIndexByName = (name2) => {
|
6202
|
+
const setCurrentIndexByName = (name2, skipScrollIntoView) => {
|
6145
6203
|
const matched = children.find((tab, index2) => getTabName(tab, index2) === name2);
|
6146
6204
|
const index = matched ? children.indexOf(matched) : 0;
|
6147
|
-
setCurrentIndex(index);
|
6205
|
+
setCurrentIndex(index, skipScrollIntoView);
|
6148
6206
|
};
|
6149
6207
|
const scrollToCurrentContent = (immediate = false) => {
|
6150
6208
|
if (props.scrollspy) {
|
@@ -6274,15 +6332,8 @@ var stdin_default$11 = vue.defineComponent({
|
|
6274
6332
|
});
|
6275
6333
|
}
|
6276
6334
|
});
|
6277
|
-
vue.watch(() => state.currentIndex, () => {
|
6278
|
-
scrollIntoView();
|
6279
|
-
setLine();
|
6280
|
-
if (stickyFixed && !props.scrollspy) {
|
6281
|
-
setRootScrollTop(Math.ceil(getElementTop(root.value) - offsetTopPx.value));
|
6282
|
-
}
|
6283
|
-
});
|
6284
6335
|
const init = () => {
|
6285
|
-
setCurrentIndexByName(props.active);
|
6336
|
+
setCurrentIndexByName(props.active, true);
|
6286
6337
|
vue.nextTick(() => {
|
6287
6338
|
state.inited = true;
|
6288
6339
|
if (wrapRef.value) {
|
@@ -6475,6 +6526,16 @@ var stdin_default$$ = vue.defineComponent({
|
|
6475
6526
|
}
|
6476
6527
|
return isActive;
|
6477
6528
|
});
|
6529
|
+
const hasInactiveClass = vue.ref(!active.value);
|
6530
|
+
vue.watch(active, (val) => {
|
6531
|
+
if (val) {
|
6532
|
+
hasInactiveClass.value = false;
|
6533
|
+
} else {
|
6534
|
+
use.doubleRaf(() => {
|
6535
|
+
hasInactiveClass.value = true;
|
6536
|
+
});
|
6537
|
+
}
|
6538
|
+
});
|
6478
6539
|
vue.watch(() => props.title, () => {
|
6479
6540
|
parent.setLine();
|
6480
6541
|
parent.scrollIntoView();
|
@@ -6498,7 +6559,7 @@ var stdin_default$$ = vue.defineComponent({
|
|
6498
6559
|
"id": id,
|
6499
6560
|
"role": "tabpanel",
|
6500
6561
|
"class": bem$U("panel-wrapper", {
|
6501
|
-
inactive:
|
6562
|
+
inactive: hasInactiveClass.value
|
6502
6563
|
}),
|
6503
6564
|
"tabindex": active.value ? 0 : -1,
|
6504
6565
|
"aria-hidden": !active.value,
|
@@ -7738,7 +7799,9 @@ var stdin_default$O = vue.defineComponent({
|
|
7738
7799
|
const CountDown = withInstall(stdin_default$O);
|
7739
7800
|
function getDate(timeStamp) {
|
7740
7801
|
const date = new Date(timeStamp * 1e3);
|
7741
|
-
return `${date.getFullYear()}.${padZero(date.getMonth() + 1)}.${padZero(
|
7802
|
+
return `${date.getFullYear()}.${padZero(date.getMonth() + 1)}.${padZero(
|
7803
|
+
date.getDate()
|
7804
|
+
)}`;
|
7742
7805
|
}
|
7743
7806
|
const formatDiscount = (discount) => (discount / 10).toFixed(discount % 10 === 0 ? 0 : 1);
|
7744
7807
|
const formatAmount = (amount) => (amount / 100).toFixed(amount % 100 === 0 ? 0 : amount % 10 === 0 ? 1 : 2);
|
@@ -9543,6 +9606,7 @@ var stdin_default$A = vue.defineComponent({
|
|
9543
9606
|
displayHeight: 0
|
9544
9607
|
});
|
9545
9608
|
const touch = useTouch();
|
9609
|
+
const swipeItem = vue.ref();
|
9546
9610
|
const vertical = vue.computed(() => {
|
9547
9611
|
const {
|
9548
9612
|
rootWidth,
|
@@ -9728,6 +9792,12 @@ var stdin_default$A = vue.defineComponent({
|
|
9728
9792
|
resetScale();
|
9729
9793
|
}
|
9730
9794
|
});
|
9795
|
+
use.useEventListener("touchmove", onTouchMove, {
|
9796
|
+
target: vue.computed(() => {
|
9797
|
+
var _a;
|
9798
|
+
return (_a = swipeItem.value) == null ? void 0 : _a.$el;
|
9799
|
+
})
|
9800
|
+
});
|
9731
9801
|
return () => {
|
9732
9802
|
const imageSlots = {
|
9733
9803
|
loading: () => vue.createVNode(Loading, {
|
@@ -9735,9 +9805,9 @@ var stdin_default$A = vue.defineComponent({
|
|
9735
9805
|
}, null)
|
9736
9806
|
};
|
9737
9807
|
return vue.createVNode(SwipeItem, {
|
9808
|
+
"ref": swipeItem,
|
9738
9809
|
"class": bem$v("swipe-item"),
|
9739
9810
|
"onTouchstartPassive": onTouchStart,
|
9740
|
-
"onTouchmove": onTouchMove,
|
9741
9811
|
"onTouchend": onTouchEnd,
|
9742
9812
|
"onTouchcancel": onTouchEnd
|
9743
9813
|
}, {
|
@@ -9991,6 +10061,7 @@ var stdin_default$y = vue.defineComponent({
|
|
9991
10061
|
slots
|
9992
10062
|
}) {
|
9993
10063
|
const root = vue.ref();
|
10064
|
+
const sidebar = vue.ref();
|
9994
10065
|
const activeAnchor = vue.ref("");
|
9995
10066
|
const touch = useTouch();
|
9996
10067
|
const scrollParent = use.useScrollParent(root);
|
@@ -10110,11 +10181,11 @@ var stdin_default$y = vue.defineComponent({
|
|
10110
10181
|
const {
|
10111
10182
|
offsetHeight
|
10112
10183
|
} = document.documentElement;
|
10184
|
+
match.$el.scrollIntoView();
|
10113
10185
|
if (scrollTop === offsetHeight - scrollParentRect.height) {
|
10114
10186
|
onScroll();
|
10115
10187
|
return;
|
10116
10188
|
}
|
10117
|
-
match.$el.scrollIntoView();
|
10118
10189
|
if (props.sticky && props.stickyOffsetTop) {
|
10119
10190
|
setRootScrollTop(getRootScrollTop() - props.stickyOffsetTop);
|
10120
10191
|
}
|
@@ -10154,15 +10225,18 @@ var stdin_default$y = vue.defineComponent({
|
|
10154
10225
|
}
|
10155
10226
|
};
|
10156
10227
|
const renderSidebar = () => vue.createVNode("div", {
|
10228
|
+
"ref": sidebar,
|
10157
10229
|
"class": bem$t("sidebar"),
|
10158
10230
|
"style": sidebarStyle.value,
|
10159
10231
|
"onClick": onClickSidebar,
|
10160
|
-
"onTouchstartPassive": touch.start
|
10161
|
-
"onTouchmove": onTouchMove
|
10232
|
+
"onTouchstartPassive": touch.start
|
10162
10233
|
}, [renderIndexes()]);
|
10163
10234
|
useExpose({
|
10164
10235
|
scrollTo
|
10165
10236
|
});
|
10237
|
+
use.useEventListener("touchmove", onTouchMove, {
|
10238
|
+
target: sidebar
|
10239
|
+
});
|
10166
10240
|
return () => {
|
10167
10241
|
var _a;
|
10168
10242
|
return vue.createVNode("div", {
|
@@ -11861,6 +11935,9 @@ var stdin_default$l = vue.defineComponent({
|
|
11861
11935
|
}, null)]);
|
11862
11936
|
};
|
11863
11937
|
use.useCustomFieldValue(() => props.modelValue);
|
11938
|
+
use.useEventListener("touchmove", onTouchMove, {
|
11939
|
+
target: groupRef
|
11940
|
+
});
|
11864
11941
|
return () => vue.createVNode("div", {
|
11865
11942
|
"ref": groupRef,
|
11866
11943
|
"role": "radiogroup",
|
@@ -11871,8 +11948,7 @@ var stdin_default$l = vue.defineComponent({
|
|
11871
11948
|
"tabindex": props.disabled ? void 0 : 0,
|
11872
11949
|
"aria-disabled": props.disabled,
|
11873
11950
|
"aria-readonly": props.readonly,
|
11874
|
-
"onTouchstartPassive": onTouchStart
|
11875
|
-
"onTouchmove": onTouchMove
|
11951
|
+
"onTouchstartPassive": onTouchStart
|
11876
11952
|
}, [list.value.map(renderStar)]);
|
11877
11953
|
}
|
11878
11954
|
});
|
@@ -12311,6 +12387,7 @@ var stdin_default$f = vue.defineComponent({
|
|
12311
12387
|
let current2;
|
12312
12388
|
let startValue;
|
12313
12389
|
const root = vue.ref();
|
12390
|
+
const slider = vue.ref();
|
12314
12391
|
const dragStatus = vue.ref();
|
12315
12392
|
const touch = useTouch();
|
12316
12393
|
const scope = vue.computed(() => Number(props.max) - Number(props.min));
|
@@ -12503,6 +12580,7 @@ var stdin_default$f = vue.defineComponent({
|
|
12503
12580
|
const renderButton = (index) => {
|
12504
12581
|
const current22 = typeof index === "number" ? props.modelValue[index] : props.modelValue;
|
12505
12582
|
return vue.createVNode("div", {
|
12583
|
+
"ref": slider,
|
12506
12584
|
"role": "slider",
|
12507
12585
|
"class": getButtonClassName(index),
|
12508
12586
|
"tabindex": props.disabled ? void 0 : 0,
|
@@ -12518,7 +12596,6 @@ var stdin_default$f = vue.defineComponent({
|
|
12518
12596
|
}
|
12519
12597
|
onTouchStart(event);
|
12520
12598
|
},
|
12521
|
-
"onTouchmove": onTouchMove,
|
12522
12599
|
"onTouchend": onTouchEnd,
|
12523
12600
|
"onTouchcancel": onTouchEnd,
|
12524
12601
|
"onClick": stopPropagation
|
@@ -12526,6 +12603,9 @@ var stdin_default$f = vue.defineComponent({
|
|
12526
12603
|
};
|
12527
12604
|
updateValue(props.modelValue);
|
12528
12605
|
use.useCustomFieldValue(() => props.modelValue);
|
12606
|
+
use.useEventListener("touchmove", onTouchMove, {
|
12607
|
+
target: slider
|
12608
|
+
});
|
12529
12609
|
return () => vue.createVNode("div", {
|
12530
12610
|
"ref": root,
|
12531
12611
|
"style": wrapperStyle.value,
|
@@ -13250,6 +13330,9 @@ var stdin_default$9 = vue.defineComponent({
|
|
13250
13330
|
use.useClickAway(root, () => onClick("outside"), {
|
13251
13331
|
eventName: "touchstart"
|
13252
13332
|
});
|
13333
|
+
use.useEventListener("touchmove", onTouchMove, {
|
13334
|
+
target: root
|
13335
|
+
});
|
13253
13336
|
return () => {
|
13254
13337
|
var _a;
|
13255
13338
|
const wrapperStyle = {
|
@@ -13261,7 +13344,6 @@ var stdin_default$9 = vue.defineComponent({
|
|
13261
13344
|
"class": bem$4(),
|
13262
13345
|
"onClick": getClickHandler("cell", lockClick2),
|
13263
13346
|
"onTouchstartPassive": onTouchStart,
|
13264
|
-
"onTouchmove": onTouchMove,
|
13265
13347
|
"onTouchend": onTouchEnd,
|
13266
13348
|
"onTouchcancel": onTouchEnd
|
13267
13349
|
}, [vue.createVNode("div", {
|
@@ -13995,7 +14077,10 @@ function getBestSelectionFromSrcset(el, scale) {
|
|
13995
14077
|
tmpWidth = 999998;
|
13996
14078
|
} else {
|
13997
14079
|
tmpSrc = item.substr(0, spaceIndex);
|
13998
|
-
tmpWidth = parseInt(
|
14080
|
+
tmpWidth = parseInt(
|
14081
|
+
item.substr(spaceIndex + 1, item.length - spaceIndex - 2),
|
14082
|
+
10
|
14083
|
+
);
|
13999
14084
|
}
|
14000
14085
|
return [tmpWidth, tmpSrc];
|
14001
14086
|
});
|
@@ -14186,24 +14271,32 @@ class ReactiveListener {
|
|
14186
14271
|
}
|
14187
14272
|
renderLoading(cb) {
|
14188
14273
|
this.state.loading = true;
|
14189
|
-
loadImageAsync(
|
14190
|
-
|
14191
|
-
|
14192
|
-
|
14193
|
-
|
14194
|
-
|
14195
|
-
|
14196
|
-
|
14197
|
-
|
14198
|
-
|
14199
|
-
|
14200
|
-
|
14201
|
-
|
14274
|
+
loadImageAsync(
|
14275
|
+
{
|
14276
|
+
src: this.loading,
|
14277
|
+
cors: this.cors
|
14278
|
+
},
|
14279
|
+
() => {
|
14280
|
+
this.render("loading", false);
|
14281
|
+
this.state.loading = false;
|
14282
|
+
cb();
|
14283
|
+
},
|
14284
|
+
() => {
|
14285
|
+
cb();
|
14286
|
+
this.state.loading = false;
|
14287
|
+
if (process.env.NODE_ENV !== "production" && !this.options.silent)
|
14288
|
+
console.warn(
|
14289
|
+
`[@vant/lazyload] load failed with loading image(${this.loading})`
|
14290
|
+
);
|
14291
|
+
}
|
14292
|
+
);
|
14202
14293
|
}
|
14203
14294
|
load(onFinish = noop) {
|
14204
14295
|
if (this.attempt > this.options.attempt - 1 && this.state.error) {
|
14205
14296
|
if (process.env.NODE_ENV !== "production" && !this.options.silent) {
|
14206
|
-
console.log(
|
14297
|
+
console.log(
|
14298
|
+
`[@vant/lazyload] ${this.src} tried too more than ${this.options.attempt} times`
|
14299
|
+
);
|
14207
14300
|
}
|
14208
14301
|
onFinish();
|
14209
14302
|
return;
|
@@ -14221,25 +14314,29 @@ class ReactiveListener {
|
|
14221
14314
|
this.attempt++;
|
14222
14315
|
(_b = (_a = this.options.adapter).beforeLoad) == null ? void 0 : _b.call(_a, this, this.options);
|
14223
14316
|
this.record("loadStart");
|
14224
|
-
loadImageAsync(
|
14225
|
-
|
14226
|
-
|
14227
|
-
|
14228
|
-
|
14229
|
-
|
14230
|
-
|
14231
|
-
|
14232
|
-
|
14233
|
-
|
14234
|
-
|
14235
|
-
|
14236
|
-
|
14237
|
-
|
14238
|
-
|
14239
|
-
|
14240
|
-
|
14241
|
-
|
14242
|
-
|
14317
|
+
loadImageAsync(
|
14318
|
+
{
|
14319
|
+
src: this.src,
|
14320
|
+
cors: this.cors
|
14321
|
+
},
|
14322
|
+
(data) => {
|
14323
|
+
this.naturalHeight = data.naturalHeight;
|
14324
|
+
this.naturalWidth = data.naturalWidth;
|
14325
|
+
this.state.loaded = true;
|
14326
|
+
this.state.error = false;
|
14327
|
+
this.record("loadEnd");
|
14328
|
+
this.render("loaded", false);
|
14329
|
+
this.state.rendered = true;
|
14330
|
+
this.imageCache.add(this.src);
|
14331
|
+
onFinish();
|
14332
|
+
},
|
14333
|
+
(err) => {
|
14334
|
+
!this.options.silent && console.error(err);
|
14335
|
+
this.state.error = true;
|
14336
|
+
this.state.loaded = false;
|
14337
|
+
this.render("error", false);
|
14338
|
+
}
|
14339
|
+
);
|
14243
14340
|
});
|
14244
14341
|
}
|
14245
14342
|
render(state, cache) {
|
@@ -14324,7 +14421,10 @@ function stdin_default$3() {
|
|
14324
14421
|
};
|
14325
14422
|
this.initEvent();
|
14326
14423
|
this.imageCache = new ImageCache({ max: 200 });
|
14327
|
-
this.lazyLoadHandler = throttle(
|
14424
|
+
this.lazyLoadHandler = throttle(
|
14425
|
+
this.lazyLoadHandler.bind(this),
|
14426
|
+
this.options.throttleWait
|
14427
|
+
);
|
14328
14428
|
this.setMode(this.options.observer ? modeType.observer : modeType.event);
|
14329
14429
|
}
|
14330
14430
|
config(options = {}) {
|
@@ -14479,7 +14579,9 @@ function stdin_default$3() {
|
|
14479
14579
|
});
|
14480
14580
|
}
|
14481
14581
|
initListen(el, start) {
|
14482
|
-
this.options.ListenEvents.forEach(
|
14582
|
+
this.options.ListenEvents.forEach(
|
14583
|
+
(evt) => (start ? on : off)(el, evt, this.lazyLoadHandler)
|
14584
|
+
);
|
14483
14585
|
}
|
14484
14586
|
initEvent() {
|
14485
14587
|
this.Event = {
|
@@ -14536,7 +14638,10 @@ function stdin_default$3() {
|
|
14536
14638
|
if (!hasIntersectionObserver) {
|
14537
14639
|
return;
|
14538
14640
|
}
|
14539
|
-
this.observer = new IntersectionObserver(
|
14641
|
+
this.observer = new IntersectionObserver(
|
14642
|
+
this.observerHandler.bind(this),
|
14643
|
+
this.options.observerOptions
|
14644
|
+
);
|
14540
14645
|
if (this.listeners.length) {
|
14541
14646
|
this.listeners.forEach((listener) => {
|
14542
14647
|
this.observer.observe(listener.el);
|
@@ -14615,7 +14720,10 @@ var stdin_default$2 = (lazy) => ({
|
|
14615
14720
|
},
|
14616
14721
|
emits: ["show"],
|
14617
14722
|
render() {
|
14618
|
-
return vue.h(
|
14723
|
+
return vue.h(
|
14724
|
+
this.tag,
|
14725
|
+
this.show && this.$slots.default ? this.$slots.default() : null
|
14726
|
+
);
|
14619
14727
|
},
|
14620
14728
|
data() {
|
14621
14729
|
return {
|
@@ -14667,13 +14775,17 @@ class LazyContainer {
|
|
14667
14775
|
this.options = Object.assign({}, defaultOptions, binding.value);
|
14668
14776
|
const imgs = this.getImgs();
|
14669
14777
|
imgs.forEach((el2) => {
|
14670
|
-
this.lazy.add(
|
14671
|
-
|
14672
|
-
|
14673
|
-
|
14674
|
-
|
14675
|
-
|
14676
|
-
|
14778
|
+
this.lazy.add(
|
14779
|
+
el2,
|
14780
|
+
Object.assign({}, this.binding, {
|
14781
|
+
value: {
|
14782
|
+
src: "dataset" in el2 ? el2.dataset.src : el2.getAttribute("data-src"),
|
14783
|
+
error: ("dataset" in el2 ? el2.dataset.error : el2.getAttribute("data-error")) || this.options.error,
|
14784
|
+
loading: ("dataset" in el2 ? el2.dataset.loading : el2.getAttribute("data-loading")) || this.options.loading
|
14785
|
+
}
|
14786
|
+
}),
|
14787
|
+
this.vnode
|
14788
|
+
);
|
14677
14789
|
});
|
14678
14790
|
}
|
14679
14791
|
getImgs() {
|
@@ -14724,11 +14836,15 @@ var stdin_default$1 = (lazyManager) => ({
|
|
14724
14836
|
}
|
14725
14837
|
},
|
14726
14838
|
render(h) {
|
14727
|
-
return h(
|
14728
|
-
|
14729
|
-
|
14730
|
-
|
14731
|
-
|
14839
|
+
return h(
|
14840
|
+
this.tag,
|
14841
|
+
{
|
14842
|
+
attrs: {
|
14843
|
+
src: this.renderSrc
|
14844
|
+
}
|
14845
|
+
},
|
14846
|
+
this.$slots.default
|
14847
|
+
);
|
14732
14848
|
},
|
14733
14849
|
data() {
|
14734
14850
|
return {
|
@@ -14782,20 +14898,26 @@ var stdin_default$1 = (lazyManager) => ({
|
|
14782
14898
|
load(onFinish = noop) {
|
14783
14899
|
if (this.state.attempt > this.options.attempt - 1 && this.state.error) {
|
14784
14900
|
if (process.env.NODE_ENV !== "production" && !lazyManager.options.silent) {
|
14785
|
-
console.log(
|
14901
|
+
console.log(
|
14902
|
+
`[@vant/lazyload] ${this.options.src} tried too more than ${this.options.attempt} times`
|
14903
|
+
);
|
14786
14904
|
}
|
14787
14905
|
onFinish();
|
14788
14906
|
return;
|
14789
14907
|
}
|
14790
14908
|
const { src } = this.options;
|
14791
|
-
loadImageAsync(
|
14792
|
-
|
14793
|
-
|
14794
|
-
|
14795
|
-
|
14796
|
-
|
14797
|
-
|
14798
|
-
|
14909
|
+
loadImageAsync(
|
14910
|
+
{ src },
|
14911
|
+
({ src: src2 }) => {
|
14912
|
+
this.renderSrc = src2;
|
14913
|
+
this.state.loaded = true;
|
14914
|
+
},
|
14915
|
+
() => {
|
14916
|
+
this.state.attempt++;
|
14917
|
+
this.renderSrc = this.options.error;
|
14918
|
+
this.state.error = true;
|
14919
|
+
}
|
14920
|
+
);
|
14799
14921
|
}
|
14800
14922
|
}
|
14801
14923
|
});
|
@@ -14823,7 +14945,7 @@ const Lazyload = {
|
|
14823
14945
|
});
|
14824
14946
|
}
|
14825
14947
|
};
|
14826
|
-
const version = "3.6.
|
14948
|
+
const version = "3.6.3";
|
14827
14949
|
function install(app) {
|
14828
14950
|
const components = [
|
14829
14951
|
ActionBar,
|