vant 4.0.0-rc.9 → 4.0.1

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/lib/index.d.ts CHANGED
@@ -94,4 +94,4 @@ declare namespace _default {
94
94
  }
95
95
  export default _default;
96
96
  export function install(app: any): void;
97
- export const version: "4.0.0-rc.9";
97
+ export const version: "4.0.1";
package/lib/index.js CHANGED
@@ -202,7 +202,7 @@ __reExport(stdin_exports, require("./time-picker"), module.exports);
202
202
  __reExport(stdin_exports, require("./toast"), module.exports);
203
203
  __reExport(stdin_exports, require("./tree-select"), module.exports);
204
204
  __reExport(stdin_exports, require("./uploader"), module.exports);
205
- const version = "4.0.0-rc.9";
205
+ const version = "4.0.1";
206
206
  function install(app) {
207
207
  const components = [
208
208
  import_action_bar.ActionBar,
@@ -7,6 +7,7 @@ export declare const listProps: {
7
7
  default: number;
8
8
  };
9
9
  loading: BooleanConstructor;
10
+ disabled: BooleanConstructor;
10
11
  finished: BooleanConstructor;
11
12
  errorText: StringConstructor;
12
13
  direction: {
@@ -28,6 +29,7 @@ declare const _default: import("vue").DefineComponent<{
28
29
  default: number;
29
30
  };
30
31
  loading: BooleanConstructor;
32
+ disabled: BooleanConstructor;
31
33
  finished: BooleanConstructor;
32
34
  errorText: StringConstructor;
33
35
  direction: {
@@ -47,6 +49,7 @@ declare const _default: import("vue").DefineComponent<{
47
49
  default: number;
48
50
  };
49
51
  loading: BooleanConstructor;
52
+ disabled: BooleanConstructor;
50
53
  finished: BooleanConstructor;
51
54
  errorText: StringConstructor;
52
55
  direction: {
@@ -65,6 +68,7 @@ declare const _default: import("vue").DefineComponent<{
65
68
  "onUpdate:loading"?: ((...args: any[]) => any) | undefined;
66
69
  }, {
67
70
  offset: string | number;
71
+ disabled: boolean;
68
72
  error: boolean;
69
73
  loading: boolean;
70
74
  direction: ListDirection;
package/lib/list/List.js CHANGED
@@ -33,6 +33,7 @@ const listProps = {
33
33
  error: Boolean,
34
34
  offset: (0, import_utils.makeNumericProp)(300),
35
35
  loading: Boolean,
36
+ disabled: Boolean,
36
37
  finished: Boolean,
37
38
  errorText: String,
38
39
  direction: (0, import_utils.makeStringProp)("down"),
@@ -55,7 +56,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
55
56
  const scrollParent = (0, import_use.useScrollParent)(root);
56
57
  const check = () => {
57
58
  (0, import_vue2.nextTick)(() => {
58
- if (loading.value || props.finished || props.error || (tabStatus == null ? void 0 : tabStatus.value) === false) {
59
+ if (loading.value || props.finished || props.disabled || props.error || (tabStatus == null ? void 0 : tabStatus.value) === false) {
59
60
  return;
60
61
  }
61
62
  const {
@@ -108,7 +109,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
108
109
  }
109
110
  };
110
111
  const renderLoading = () => {
111
- if (loading.value && !props.finished) {
112
+ if (loading.value && !props.finished && !props.disabled) {
112
113
  return (0, import_vue.createVNode)("div", {
113
114
  "class": bem("loading")
114
115
  }, [slots.loading ? slots.loading() : (0, import_vue.createVNode)(import_loading.Loading, {
@@ -6,6 +6,7 @@ export declare const List: import("../utils").WithInstall<import("vue").DefineCo
6
6
  default: number;
7
7
  };
8
8
  loading: BooleanConstructor;
9
+ disabled: BooleanConstructor;
9
10
  finished: BooleanConstructor;
10
11
  errorText: StringConstructor;
11
12
  direction: {
@@ -25,6 +26,7 @@ export declare const List: import("../utils").WithInstall<import("vue").DefineCo
25
26
  default: number;
26
27
  };
27
28
  loading: BooleanConstructor;
29
+ disabled: BooleanConstructor;
28
30
  finished: BooleanConstructor;
29
31
  errorText: StringConstructor;
30
32
  direction: {
@@ -43,6 +45,7 @@ export declare const List: import("../utils").WithInstall<import("vue").DefineCo
43
45
  "onUpdate:loading"?: ((...args: any[]) => any) | undefined;
44
46
  }, {
45
47
  offset: string | number;
48
+ disabled: boolean;
46
49
  error: boolean;
47
50
  loading: boolean;
48
51
  direction: import("./types").ListDirection;
@@ -89,6 +89,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
89
89
  });
90
90
  const hasOptions = (0, import_vue2.computed)(() => currentColumns.value.some((options) => options.length));
91
91
  const selectedOptions = (0, import_vue2.computed)(() => currentColumns.value.map((options, index) => (0, import_utils2.findOptionByValue)(options, selectedValues.value[index], fields.value)));
92
+ const selectedIndexes = (0, import_vue2.computed)(() => currentColumns.value.map((options, index) => options.findIndex((option) => option[fields.value.value] === selectedValues.value[index])));
92
93
  const setValue = (index, value) => {
93
94
  if (selectedValues.value[index] !== value) {
94
95
  const newValues = selectedValues.value.slice(0);
@@ -98,7 +99,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
98
99
  };
99
100
  const getEventParams = () => ({
100
101
  selectedValues: selectedValues.value.slice(0),
101
- selectedOptions: selectedOptions.value
102
+ selectedOptions: selectedOptions.value,
103
+ selectedIndexes: selectedIndexes.value
102
104
  });
103
105
  const onChange = (value, columnIndex) => {
104
106
  setValue(columnIndex, value);
@@ -37,6 +37,7 @@ export type PickerInstance = ComponentPublicInstance<PickerProps, PickerExpose>;
37
37
  export type PickerConfirmEventParams = {
38
38
  selectedValues: Numeric[];
39
39
  selectedOptions: Array<PickerOption | undefined>;
40
+ selectedIndexes: number[];
40
41
  };
41
42
  export type PickerCancelEventParams = PickerConfirmEventParams;
42
43
  export type PickerChangeEventParams = PickerConfirmEventParams & {
package/lib/vant.cjs.js CHANGED
@@ -3151,6 +3151,7 @@ var stdin_default$1n = vue.defineComponent({
3151
3151
  });
3152
3152
  const hasOptions = vue.computed(() => currentColumns.value.some((options) => options.length));
3153
3153
  const selectedOptions = vue.computed(() => currentColumns.value.map((options, index) => findOptionByValue(options, selectedValues.value[index], fields.value)));
3154
+ const selectedIndexes = vue.computed(() => currentColumns.value.map((options, index) => options.findIndex((option) => option[fields.value.value] === selectedValues.value[index])));
3154
3155
  const setValue = (index, value) => {
3155
3156
  if (selectedValues.value[index] !== value) {
3156
3157
  const newValues = selectedValues.value.slice(0);
@@ -3160,7 +3161,8 @@ var stdin_default$1n = vue.defineComponent({
3160
3161
  };
3161
3162
  const getEventParams = () => ({
3162
3163
  selectedValues: selectedValues.value.slice(0),
3163
- selectedOptions: selectedOptions.value
3164
+ selectedOptions: selectedOptions.value,
3165
+ selectedIndexes: selectedIndexes.value
3164
3166
  });
3165
3167
  const onChange = (value, columnIndex) => {
3166
3168
  setValue(columnIndex, value);
@@ -3983,7 +3985,14 @@ var stdin_default$1j = vue.defineComponent({
3983
3985
  value = props.formatter(value);
3984
3986
  }
3985
3987
  if (inputRef.value && inputRef.value.value !== value) {
3988
+ const {
3989
+ selectionStart,
3990
+ selectionEnd
3991
+ } = inputRef.value;
3986
3992
  inputRef.value.value = value;
3993
+ if (state.focused) {
3994
+ inputRef.value.setSelectionRange(selectionStart, selectionEnd);
3995
+ }
3987
3996
  }
3988
3997
  if (value !== props.modelValue) {
3989
3998
  emit("update:modelValue", value);
@@ -5501,10 +5510,10 @@ class ImageCache {
5501
5510
  }
5502
5511
  const [name$12, bem$_] = createNamespace("back-top");
5503
5512
  const backTopProps = {
5504
- right: makeNumericProp(30),
5505
- bottom: makeNumericProp(40),
5513
+ right: numericProp,
5514
+ bottom: numericProp,
5506
5515
  target: [String, Object],
5507
- visibilityHeight: makeNumericProp(200),
5516
+ offset: makeNumericProp(200),
5508
5517
  teleport: {
5509
5518
  type: [String, Object],
5510
5519
  default: "body"
@@ -5521,50 +5530,52 @@ var stdin_default$18 = vue.defineComponent({
5521
5530
  attrs
5522
5531
  }) {
5523
5532
  const show = vue.ref(false);
5533
+ const root = vue.ref();
5524
5534
  const scrollParent = vue.ref();
5525
- const root = vue.ref(null);
5526
- let target;
5527
5535
  const style = vue.computed(() => ({
5528
5536
  right: addUnit(props.right),
5529
5537
  bottom: addUnit(props.bottom)
5530
5538
  }));
5531
5539
  const onClick = (event) => {
5540
+ var _a;
5532
5541
  emit("click", event);
5533
- target.scrollTo({
5542
+ (_a = scrollParent.value) == null ? void 0 : _a.scrollTo({
5534
5543
  top: 0,
5535
5544
  behavior: "smooth"
5536
5545
  });
5537
5546
  };
5538
5547
  const scroll = () => {
5539
- show.value = getScrollTop(target) >= props.visibilityHeight;
5548
+ show.value = scrollParent.value ? getScrollTop(scrollParent.value) >= props.offset : false;
5540
5549
  };
5541
5550
  const getTarget = () => {
5542
5551
  const {
5543
- target: target2
5552
+ target
5544
5553
  } = props;
5545
- if (typeof target2 === "string") {
5546
- const el = document.querySelector(props.target);
5547
- if (!el) {
5548
- throw Error("[Vant] BackTop: target element is not found.");
5554
+ if (typeof target === "string") {
5555
+ const el = document.querySelector(target);
5556
+ if (el) {
5557
+ return el;
5558
+ }
5559
+ if (process.env.NODE_ENV !== "production") {
5560
+ console.error(`[Vant] BackTop: target element "${target}" was not found, the BackTop component will not be rendered.`);
5549
5561
  }
5550
- return el;
5562
+ } else {
5563
+ return target;
5551
5564
  }
5552
- if (isObject(target2)) {
5553
- return target2;
5565
+ };
5566
+ const updateTarget = () => {
5567
+ if (inBrowser) {
5568
+ vue.nextTick(() => {
5569
+ scrollParent.value = props.target ? getTarget() : use.getScrollParent(root.value);
5570
+ scroll();
5571
+ });
5554
5572
  }
5555
- throw Error('[Vant] BackTop: type of prop "target" should be a selector or an element object');
5556
5573
  };
5557
- use.useEventListener("scroll", throttle(scroll, 300), {
5574
+ use.useEventListener("scroll", throttle(scroll, 100), {
5558
5575
  target: scrollParent
5559
5576
  });
5560
- vue.onMounted(() => {
5561
- vue.nextTick(() => {
5562
- if (inBrowser) {
5563
- target = props.target ? getTarget() : use.getScrollParent(root.value);
5564
- scrollParent.value = target;
5565
- }
5566
- });
5567
- });
5577
+ vue.onMounted(updateTarget);
5578
+ vue.watch(() => props.target, updateTarget);
5568
5579
  return () => {
5569
5580
  const Content = vue.createVNode("div", vue.mergeProps({
5570
5581
  "ref": root,
@@ -10186,6 +10197,7 @@ const listProps = {
10186
10197
  error: Boolean,
10187
10198
  offset: makeNumericProp(300),
10188
10199
  loading: Boolean,
10200
+ disabled: Boolean,
10189
10201
  finished: Boolean,
10190
10202
  errorText: String,
10191
10203
  direction: makeStringProp("down"),
@@ -10208,7 +10220,7 @@ var stdin_default$B = vue.defineComponent({
10208
10220
  const scrollParent = use.useScrollParent(root);
10209
10221
  const check = () => {
10210
10222
  vue.nextTick(() => {
10211
- if (loading.value || props.finished || props.error || (tabStatus == null ? void 0 : tabStatus.value) === false) {
10223
+ if (loading.value || props.finished || props.disabled || props.error || (tabStatus == null ? void 0 : tabStatus.value) === false) {
10212
10224
  return;
10213
10225
  }
10214
10226
  const {
@@ -10261,7 +10273,7 @@ var stdin_default$B = vue.defineComponent({
10261
10273
  }
10262
10274
  };
10263
10275
  const renderLoading = () => {
10264
- if (loading.value && !props.finished) {
10276
+ if (loading.value && !props.finished && !props.disabled) {
10265
10277
  return vue.createVNode("div", {
10266
10278
  "class": bem$v("loading")
10267
10279
  }, [slots.loading ? slots.loading() : vue.createVNode(Loading, {
@@ -14809,7 +14821,7 @@ const Lazyload = {
14809
14821
  });
14810
14822
  }
14811
14823
  };
14812
- const version = "4.0.0-rc.9";
14824
+ const version = "4.0.1";
14813
14825
  function install(app) {
14814
14826
  const components = [
14815
14827
  ActionBar,
package/lib/vant.es.js CHANGED
@@ -3149,6 +3149,7 @@ var stdin_default$1n = defineComponent({
3149
3149
  });
3150
3150
  const hasOptions = computed(() => currentColumns.value.some((options) => options.length));
3151
3151
  const selectedOptions = computed(() => currentColumns.value.map((options, index) => findOptionByValue(options, selectedValues.value[index], fields.value)));
3152
+ const selectedIndexes = computed(() => currentColumns.value.map((options, index) => options.findIndex((option) => option[fields.value.value] === selectedValues.value[index])));
3152
3153
  const setValue = (index, value) => {
3153
3154
  if (selectedValues.value[index] !== value) {
3154
3155
  const newValues = selectedValues.value.slice(0);
@@ -3158,7 +3159,8 @@ var stdin_default$1n = defineComponent({
3158
3159
  };
3159
3160
  const getEventParams = () => ({
3160
3161
  selectedValues: selectedValues.value.slice(0),
3161
- selectedOptions: selectedOptions.value
3162
+ selectedOptions: selectedOptions.value,
3163
+ selectedIndexes: selectedIndexes.value
3162
3164
  });
3163
3165
  const onChange = (value, columnIndex) => {
3164
3166
  setValue(columnIndex, value);
@@ -3981,7 +3983,14 @@ var stdin_default$1j = defineComponent({
3981
3983
  value = props.formatter(value);
3982
3984
  }
3983
3985
  if (inputRef.value && inputRef.value.value !== value) {
3986
+ const {
3987
+ selectionStart,
3988
+ selectionEnd
3989
+ } = inputRef.value;
3984
3990
  inputRef.value.value = value;
3991
+ if (state.focused) {
3992
+ inputRef.value.setSelectionRange(selectionStart, selectionEnd);
3993
+ }
3985
3994
  }
3986
3995
  if (value !== props.modelValue) {
3987
3996
  emit("update:modelValue", value);
@@ -5499,10 +5508,10 @@ class ImageCache {
5499
5508
  }
5500
5509
  const [name$12, bem$_] = createNamespace("back-top");
5501
5510
  const backTopProps = {
5502
- right: makeNumericProp(30),
5503
- bottom: makeNumericProp(40),
5511
+ right: numericProp,
5512
+ bottom: numericProp,
5504
5513
  target: [String, Object],
5505
- visibilityHeight: makeNumericProp(200),
5514
+ offset: makeNumericProp(200),
5506
5515
  teleport: {
5507
5516
  type: [String, Object],
5508
5517
  default: "body"
@@ -5519,50 +5528,52 @@ var stdin_default$18 = defineComponent({
5519
5528
  attrs
5520
5529
  }) {
5521
5530
  const show = ref(false);
5531
+ const root = ref();
5522
5532
  const scrollParent = ref();
5523
- const root = ref(null);
5524
- let target;
5525
5533
  const style = computed(() => ({
5526
5534
  right: addUnit(props.right),
5527
5535
  bottom: addUnit(props.bottom)
5528
5536
  }));
5529
5537
  const onClick = (event) => {
5538
+ var _a;
5530
5539
  emit("click", event);
5531
- target.scrollTo({
5540
+ (_a = scrollParent.value) == null ? void 0 : _a.scrollTo({
5532
5541
  top: 0,
5533
5542
  behavior: "smooth"
5534
5543
  });
5535
5544
  };
5536
5545
  const scroll = () => {
5537
- show.value = getScrollTop(target) >= props.visibilityHeight;
5546
+ show.value = scrollParent.value ? getScrollTop(scrollParent.value) >= props.offset : false;
5538
5547
  };
5539
5548
  const getTarget = () => {
5540
5549
  const {
5541
- target: target2
5550
+ target
5542
5551
  } = props;
5543
- if (typeof target2 === "string") {
5544
- const el = document.querySelector(props.target);
5545
- if (!el) {
5546
- throw Error("[Vant] BackTop: target element is not found.");
5552
+ if (typeof target === "string") {
5553
+ const el = document.querySelector(target);
5554
+ if (el) {
5555
+ return el;
5556
+ }
5557
+ if (process.env.NODE_ENV !== "production") {
5558
+ console.error(`[Vant] BackTop: target element "${target}" was not found, the BackTop component will not be rendered.`);
5547
5559
  }
5548
- return el;
5560
+ } else {
5561
+ return target;
5549
5562
  }
5550
- if (isObject(target2)) {
5551
- return target2;
5563
+ };
5564
+ const updateTarget = () => {
5565
+ if (inBrowser) {
5566
+ nextTick(() => {
5567
+ scrollParent.value = props.target ? getTarget() : getScrollParent(root.value);
5568
+ scroll();
5569
+ });
5552
5570
  }
5553
- throw Error('[Vant] BackTop: type of prop "target" should be a selector or an element object');
5554
5571
  };
5555
- useEventListener("scroll", throttle(scroll, 300), {
5572
+ useEventListener("scroll", throttle(scroll, 100), {
5556
5573
  target: scrollParent
5557
5574
  });
5558
- onMounted(() => {
5559
- nextTick(() => {
5560
- if (inBrowser) {
5561
- target = props.target ? getTarget() : getScrollParent(root.value);
5562
- scrollParent.value = target;
5563
- }
5564
- });
5565
- });
5575
+ onMounted(updateTarget);
5576
+ watch(() => props.target, updateTarget);
5566
5577
  return () => {
5567
5578
  const Content = createVNode("div", mergeProps({
5568
5579
  "ref": root,
@@ -10184,6 +10195,7 @@ const listProps = {
10184
10195
  error: Boolean,
10185
10196
  offset: makeNumericProp(300),
10186
10197
  loading: Boolean,
10198
+ disabled: Boolean,
10187
10199
  finished: Boolean,
10188
10200
  errorText: String,
10189
10201
  direction: makeStringProp("down"),
@@ -10206,7 +10218,7 @@ var stdin_default$B = defineComponent({
10206
10218
  const scrollParent = useScrollParent(root);
10207
10219
  const check = () => {
10208
10220
  nextTick(() => {
10209
- if (loading.value || props.finished || props.error || (tabStatus == null ? void 0 : tabStatus.value) === false) {
10221
+ if (loading.value || props.finished || props.disabled || props.error || (tabStatus == null ? void 0 : tabStatus.value) === false) {
10210
10222
  return;
10211
10223
  }
10212
10224
  const {
@@ -10259,7 +10271,7 @@ var stdin_default$B = defineComponent({
10259
10271
  }
10260
10272
  };
10261
10273
  const renderLoading = () => {
10262
- if (loading.value && !props.finished) {
10274
+ if (loading.value && !props.finished && !props.disabled) {
10263
10275
  return createVNode("div", {
10264
10276
  "class": bem$v("loading")
10265
10277
  }, [slots.loading ? slots.loading() : createVNode(Loading, {
@@ -14807,7 +14819,7 @@ const Lazyload = {
14807
14819
  });
14808
14820
  }
14809
14821
  };
14810
- const version = "4.0.0-rc.9";
14822
+ const version = "4.0.1";
14811
14823
  function install(app) {
14812
14824
  const components = [
14813
14825
  ActionBar,
package/lib/vant.js CHANGED
@@ -3509,6 +3509,7 @@
3509
3509
  });
3510
3510
  const hasOptions = vue.computed(() => currentColumns.value.some((options) => options.length));
3511
3511
  const selectedOptions = vue.computed(() => currentColumns.value.map((options, index) => findOptionByValue(options, selectedValues.value[index], fields.value)));
3512
+ const selectedIndexes = vue.computed(() => currentColumns.value.map((options, index) => options.findIndex((option) => option[fields.value.value] === selectedValues.value[index])));
3512
3513
  const setValue = (index, value) => {
3513
3514
  if (selectedValues.value[index] !== value) {
3514
3515
  const newValues = selectedValues.value.slice(0);
@@ -3518,7 +3519,8 @@
3518
3519
  };
3519
3520
  const getEventParams = () => ({
3520
3521
  selectedValues: selectedValues.value.slice(0),
3521
- selectedOptions: selectedOptions.value
3522
+ selectedOptions: selectedOptions.value,
3523
+ selectedIndexes: selectedIndexes.value
3522
3524
  });
3523
3525
  const onChange = (value, columnIndex) => {
3524
3526
  setValue(columnIndex, value);
@@ -4341,7 +4343,14 @@
4341
4343
  value = props.formatter(value);
4342
4344
  }
4343
4345
  if (inputRef.value && inputRef.value.value !== value) {
4346
+ const {
4347
+ selectionStart,
4348
+ selectionEnd
4349
+ } = inputRef.value;
4344
4350
  inputRef.value.value = value;
4351
+ if (state.focused) {
4352
+ inputRef.value.setSelectionRange(selectionStart, selectionEnd);
4353
+ }
4345
4354
  }
4346
4355
  if (value !== props.modelValue) {
4347
4356
  emit("update:modelValue", value);
@@ -5859,10 +5868,10 @@
5859
5868
  }
5860
5869
  const [name$12, bem$_] = createNamespace("back-top");
5861
5870
  const backTopProps = {
5862
- right: makeNumericProp(30),
5863
- bottom: makeNumericProp(40),
5871
+ right: numericProp,
5872
+ bottom: numericProp,
5864
5873
  target: [String, Object],
5865
- visibilityHeight: makeNumericProp(200),
5874
+ offset: makeNumericProp(200),
5866
5875
  teleport: {
5867
5876
  type: [String, Object],
5868
5877
  default: "body"
@@ -5879,50 +5888,49 @@
5879
5888
  attrs
5880
5889
  }) {
5881
5890
  const show = vue.ref(false);
5891
+ const root = vue.ref();
5882
5892
  const scrollParent = vue.ref();
5883
- const root = vue.ref(null);
5884
- let target;
5885
5893
  const style = vue.computed(() => ({
5886
5894
  right: addUnit(props.right),
5887
5895
  bottom: addUnit(props.bottom)
5888
5896
  }));
5889
5897
  const onClick = (event) => {
5898
+ var _a;
5890
5899
  emit("click", event);
5891
- target.scrollTo({
5900
+ (_a = scrollParent.value) == null ? void 0 : _a.scrollTo({
5892
5901
  top: 0,
5893
5902
  behavior: "smooth"
5894
5903
  });
5895
5904
  };
5896
5905
  const scroll = () => {
5897
- show.value = getScrollTop(target) >= props.visibilityHeight;
5906
+ show.value = scrollParent.value ? getScrollTop(scrollParent.value) >= props.offset : false;
5898
5907
  };
5899
5908
  const getTarget = () => {
5900
5909
  const {
5901
- target: target2
5910
+ target
5902
5911
  } = props;
5903
- if (typeof target2 === "string") {
5904
- const el = document.querySelector(props.target);
5905
- if (!el) {
5906
- throw Error("[Vant] BackTop: target element is not found.");
5912
+ if (typeof target === "string") {
5913
+ const el = document.querySelector(target);
5914
+ if (el) {
5915
+ return el;
5907
5916
  }
5908
- return el;
5917
+ } else {
5918
+ return target;
5909
5919
  }
5910
- if (isObject(target2)) {
5911
- return target2;
5920
+ };
5921
+ const updateTarget = () => {
5922
+ if (inBrowser$1) {
5923
+ vue.nextTick(() => {
5924
+ scrollParent.value = props.target ? getTarget() : getScrollParent$1(root.value);
5925
+ scroll();
5926
+ });
5912
5927
  }
5913
- throw Error('[Vant] BackTop: type of prop "target" should be a selector or an element object');
5914
5928
  };
5915
- useEventListener("scroll", throttle(scroll, 300), {
5929
+ useEventListener("scroll", throttle(scroll, 100), {
5916
5930
  target: scrollParent
5917
5931
  });
5918
- vue.onMounted(() => {
5919
- vue.nextTick(() => {
5920
- if (inBrowser$1) {
5921
- target = props.target ? getTarget() : getScrollParent$1(root.value);
5922
- scrollParent.value = target;
5923
- }
5924
- });
5925
- });
5932
+ vue.onMounted(updateTarget);
5933
+ vue.watch(() => props.target, updateTarget);
5926
5934
  return () => {
5927
5935
  const Content = vue.createVNode("div", vue.mergeProps({
5928
5936
  "ref": root,
@@ -10515,6 +10523,7 @@
10515
10523
  error: Boolean,
10516
10524
  offset: makeNumericProp(300),
10517
10525
  loading: Boolean,
10526
+ disabled: Boolean,
10518
10527
  finished: Boolean,
10519
10528
  errorText: String,
10520
10529
  direction: makeStringProp("down"),
@@ -10537,7 +10546,7 @@
10537
10546
  const scrollParent = useScrollParent(root);
10538
10547
  const check = () => {
10539
10548
  vue.nextTick(() => {
10540
- if (loading.value || props.finished || props.error || (tabStatus == null ? void 0 : tabStatus.value) === false) {
10549
+ if (loading.value || props.finished || props.disabled || props.error || (tabStatus == null ? void 0 : tabStatus.value) === false) {
10541
10550
  return;
10542
10551
  }
10543
10552
  const {
@@ -10590,7 +10599,7 @@
10590
10599
  }
10591
10600
  };
10592
10601
  const renderLoading = () => {
10593
- if (loading.value && !props.finished) {
10602
+ if (loading.value && !props.finished && !props.disabled) {
10594
10603
  return vue.createVNode("div", {
10595
10604
  "class": bem$v("loading")
10596
10605
  }, [slots.loading ? slots.loading() : vue.createVNode(Loading, {
@@ -16018,7 +16027,7 @@
16018
16027
  });
16019
16028
  }
16020
16029
  };
16021
- const version = "4.0.0-rc.9";
16030
+ const version = "4.0.1";
16022
16031
  function install(app) {
16023
16032
  const components = [
16024
16033
  ActionBar,