vant 4.0.4 → 4.0.6

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/vant.es.js CHANGED
@@ -1,5 +1,5 @@
1
- import { useWindowSize, useRect, useChildren, useParent, onMountedOrActivated, getScrollParent, useEventListener, raf, useScrollParent, usePageVisibility, doubleRaf, CUSTOM_FIELD_INJECTION_KEY, useCustomFieldValue, inBrowser as inBrowser$1, useToggle, cancelRaf, useCountDown, useClickAway } from "@vant/use";
2
1
  import { unref, ref, reactive, inject, watch, onMounted, nextTick, createVNode, defineComponent, getCurrentInstance, computed, onActivated, onDeactivated, onBeforeUnmount, provide, watchEffect, mergeProps, Transition, withDirectives, vShow, Teleport, Fragment, onBeforeUpdate, createTextVNode, onUnmounted, createApp, resolveDirective, withKeys, onUpdated, h } from "vue";
2
+ import { useWindowSize, useRect, useChildren, useParent, onMountedOrActivated, getScrollParent, useEventListener, raf, useScrollParent, usePageVisibility, doubleRaf, CUSTOM_FIELD_INJECTION_KEY, useCustomFieldValue, inBrowser as inBrowser$1, useToggle, cancelRaf, useCountDown, useClickAway } from "@vant/use";
3
3
  import { offsetModifier, createPopper } from "@vant/popperjs";
4
4
  const isDef = (val) => val !== void 0 && val !== null;
5
5
  const isFunction = (val) => typeof val === "function";
@@ -236,64 +236,64 @@ function deepAssign(to, from) {
236
236
  return to;
237
237
  }
238
238
  var stdin_default$1K = {
239
- name: "\u59D3\u540D",
240
- tel: "\u7535\u8BDD",
241
- save: "\u4FDD\u5B58",
242
- confirm: "\u786E\u8BA4",
243
- cancel: "\u53D6\u6D88",
244
- delete: "\u5220\u9664",
245
- loading: "\u52A0\u8F7D\u4E2D...",
246
- noCoupon: "\u6682\u65E0\u4F18\u60E0\u5238",
247
- nameEmpty: "\u8BF7\u586B\u5199\u59D3\u540D",
248
- addContact: "\u6DFB\u52A0\u8054\u7CFB\u4EBA",
249
- telInvalid: "\u8BF7\u586B\u5199\u6B63\u786E\u7684\u7535\u8BDD",
239
+ name: "姓名",
240
+ tel: "电话",
241
+ save: "保存",
242
+ confirm: "确认",
243
+ cancel: "取消",
244
+ delete: "删除",
245
+ loading: "加载中...",
246
+ noCoupon: "暂无优惠券",
247
+ nameEmpty: "请填写姓名",
248
+ addContact: "添加联系人",
249
+ telInvalid: "请填写正确的电话",
250
250
  vanCalendar: {
251
- end: "\u7ED3\u675F",
252
- start: "\u5F00\u59CB",
253
- title: "\u65E5\u671F\u9009\u62E9",
254
- weekdays: ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"],
255
- monthTitle: (year, month) => `${year}\u5E74${month}\u6708`,
256
- rangePrompt: (maxRange) => `\u6700\u591A\u9009\u62E9 ${maxRange} \u5929`
251
+ end: "结束",
252
+ start: "开始",
253
+ title: "日期选择",
254
+ weekdays: ["", "", "", "", "", "", ""],
255
+ monthTitle: (year, month) => `${year}年${month}月`,
256
+ rangePrompt: (maxRange) => `最多选择 ${maxRange} 天`
257
257
  },
258
258
  vanCascader: {
259
- select: "\u8BF7\u9009\u62E9"
259
+ select: "请选择"
260
260
  },
261
261
  vanPagination: {
262
- prev: "\u4E0A\u4E00\u9875",
263
- next: "\u4E0B\u4E00\u9875"
262
+ prev: "上一页",
263
+ next: "下一页"
264
264
  },
265
265
  vanPullRefresh: {
266
- pulling: "\u4E0B\u62C9\u5373\u53EF\u5237\u65B0...",
267
- loosing: "\u91CA\u653E\u5373\u53EF\u5237\u65B0..."
266
+ pulling: "下拉即可刷新...",
267
+ loosing: "释放即可刷新..."
268
268
  },
269
269
  vanSubmitBar: {
270
- label: "\u5408\u8BA1:"
270
+ label: "合计:"
271
271
  },
272
272
  vanCoupon: {
273
- unlimited: "\u65E0\u95E8\u69DB",
274
- discount: (discount) => `${discount}\u6298`,
275
- condition: (condition) => `\u6EE1${condition}\u5143\u53EF\u7528`
273
+ unlimited: "无门槛",
274
+ discount: (discount) => `${discount}折`,
275
+ condition: (condition) => `满${condition}元可用`
276
276
  },
277
277
  vanCouponCell: {
278
- title: "\u4F18\u60E0\u5238",
279
- count: (count) => `${count}\u5F20\u53EF\u7528`
278
+ title: "优惠券",
279
+ count: (count) => `${count}张可用`
280
280
  },
281
281
  vanCouponList: {
282
- exchange: "\u5151\u6362",
283
- close: "\u4E0D\u4F7F\u7528",
284
- enable: "\u53EF\u7528",
285
- disabled: "\u4E0D\u53EF\u7528",
286
- placeholder: "\u8F93\u5165\u4F18\u60E0\u7801"
282
+ exchange: "兑换",
283
+ close: "不使用",
284
+ enable: "可用",
285
+ disabled: "不可用",
286
+ placeholder: "输入优惠码"
287
287
  },
288
288
  vanAddressEdit: {
289
- area: "\u5730\u533A",
290
- areaEmpty: "\u8BF7\u9009\u62E9\u5730\u533A",
291
- addressEmpty: "\u8BF7\u586B\u5199\u8BE6\u7EC6\u5730\u5740",
292
- addressDetail: "\u8BE6\u7EC6\u5730\u5740",
293
- defaultAddress: "\u8BBE\u4E3A\u9ED8\u8BA4\u6536\u8D27\u5730\u5740"
289
+ area: "地区",
290
+ areaEmpty: "请选择地区",
291
+ addressEmpty: "请填写详细地址",
292
+ addressDetail: "详细地址",
293
+ defaultAddress: "设为默认收货地址"
294
294
  },
295
295
  vanAddressList: {
296
- add: "\u65B0\u589E\u5730\u5740"
296
+ add: "新增地址"
297
297
  }
298
298
  };
299
299
  const lang = ref("zh-CN");
@@ -544,18 +544,27 @@ var stdin_default$1H = defineComponent({
544
544
  return content;
545
545
  }
546
546
  };
547
+ const getOffsetWithMinusString = (val) => val.startsWith("-") ? val.replace("-", "") : `-${val}`;
547
548
  const style = computed(() => {
548
549
  const style2 = {
549
550
  background: props.color
550
551
  };
551
552
  if (props.offset) {
552
553
  const [x, y] = props.offset;
554
+ const {
555
+ position
556
+ } = props;
557
+ const [offsetY, offsetX] = position.split("-");
553
558
  if (slots.default) {
554
- style2.top = addUnit(y);
559
+ if (typeof y === "number") {
560
+ style2[offsetY] = addUnit(offsetY === "top" ? y : -y);
561
+ } else {
562
+ style2[offsetY] = offsetY === "top" ? addUnit(y) : getOffsetWithMinusString(y);
563
+ }
555
564
  if (typeof x === "number") {
556
- style2.right = addUnit(-x);
565
+ style2[offsetX] = addUnit(offsetX === "left" ? x : -x);
557
566
  } else {
558
- style2.right = x.startsWith("-") ? x.replace("-", "") : `-${x}`;
567
+ style2[offsetX] = offsetX === "left" ? addUnit(x) : getOffsetWithMinusString(x);
559
568
  }
560
569
  } else {
561
570
  style2.marginTop = addUnit(y);
@@ -3668,7 +3677,9 @@ var stdin_default$1k = defineComponent({
3668
3677
  });
3669
3678
  };
3670
3679
  const getValues = () => children.reduce((form, field) => {
3671
- form[field.name] = field.formValue.value;
3680
+ if (field.name !== void 0) {
3681
+ form[field.name] = field.formValue.value;
3682
+ }
3672
3683
  return form;
3673
3684
  }, {});
3674
3685
  const submit = () => {
@@ -6673,7 +6684,7 @@ const cardProps = {
6673
6684
  price: numericProp,
6674
6685
  centered: Boolean,
6675
6686
  lazyLoad: Boolean,
6676
- currency: makeStringProp("\xA5"),
6687
+ currency: makeStringProp("¥"),
6677
6688
  thumbLink: String,
6678
6689
  originPrice: numericProp
6679
6690
  };
@@ -7709,7 +7720,7 @@ var stdin_default$U = defineComponent({
7709
7720
  if (props.type === "add") {
7710
7721
  return props.addText || t$d("addContact");
7711
7722
  }
7712
- return [createVNode("div", null, [`${t$d("name")}\uFF1A${props.name}`]), createVNode("div", null, [`${t$d("tel")}\uFF1A${props.tel}`])];
7723
+ return [createVNode("div", null, [`${t$d("name")}:${props.name}`]), createVNode("div", null, [`${t$d("tel")}:${props.tel}`])];
7713
7724
  };
7714
7725
  return () => createVNode(Cell, {
7715
7726
  "center": true,
@@ -7860,7 +7871,7 @@ var stdin_default$S = defineComponent({
7860
7871
  }
7861
7872
  }, null);
7862
7873
  const renderContent = () => {
7863
- const nodes = [`${item.name}\uFF0C${item.tel}`];
7874
+ const nodes = [`${item.name},${item.tel}`];
7864
7875
  if (item.isDefault && props.defaultTagText) {
7865
7876
  nodes.push(createVNode(Tag, {
7866
7877
  "type": "primary",
@@ -8003,7 +8014,7 @@ var stdin_default$Q = defineComponent({
8003
8014
  chosen: Boolean,
8004
8015
  coupon: makeRequiredProp(Object),
8005
8016
  disabled: Boolean,
8006
- currency: makeStringProp("\xA5")
8017
+ currency: makeStringProp("¥")
8007
8018
  },
8008
8019
  setup(props) {
8009
8020
  const validPeriod = computed(() => {
@@ -8075,7 +8086,7 @@ const couponCellProps = {
8075
8086
  border: truthProp,
8076
8087
  editable: truthProp,
8077
8088
  coupons: makeArrayProp(),
8078
- currency: makeStringProp("\xA5"),
8089
+ currency: makeStringProp("¥"),
8079
8090
  chosenCoupon: makeNumericProp(-1)
8080
8091
  };
8081
8092
  function formatValue({
@@ -8437,7 +8448,7 @@ const [name$H, bem$G, t$8] = createNamespace("coupon-list");
8437
8448
  const couponListProps = {
8438
8449
  code: makeStringProp(""),
8439
8450
  coupons: makeArrayProp(),
8440
- currency: makeStringProp("\xA5"),
8451
+ currency: makeStringProp("¥"),
8441
8452
  showCount: truthProp,
8442
8453
  emptyImage: String,
8443
8454
  chosenCoupon: makeNumberProp(-1),
@@ -13126,7 +13137,7 @@ const submitBarProps = {
13126
13137
  price: Number,
13127
13138
  tipIcon: String,
13128
13139
  loading: Boolean,
13129
- currency: makeStringProp("\xA5"),
13140
+ currency: makeStringProp("¥"),
13130
13141
  disabled: Boolean,
13131
13142
  textAlign: String,
13132
13143
  buttonText: String,
@@ -14886,7 +14897,7 @@ const Lazyload = {
14886
14897
  });
14887
14898
  }
14888
14899
  };
14889
- const version = "4.0.4";
14900
+ const version = "4.0.6";
14890
14901
  function install(app) {
14891
14902
  const components = [
14892
14903
  ActionBar,
package/lib/vant.js CHANGED
@@ -605,64 +605,64 @@
605
605
  return to;
606
606
  }
607
607
  var stdin_default$1K = {
608
- name: "\u59D3\u540D",
609
- tel: "\u7535\u8BDD",
610
- save: "\u4FDD\u5B58",
611
- confirm: "\u786E\u8BA4",
612
- cancel: "\u53D6\u6D88",
613
- delete: "\u5220\u9664",
614
- loading: "\u52A0\u8F7D\u4E2D...",
615
- noCoupon: "\u6682\u65E0\u4F18\u60E0\u5238",
616
- nameEmpty: "\u8BF7\u586B\u5199\u59D3\u540D",
617
- addContact: "\u6DFB\u52A0\u8054\u7CFB\u4EBA",
618
- telInvalid: "\u8BF7\u586B\u5199\u6B63\u786E\u7684\u7535\u8BDD",
608
+ name: "姓名",
609
+ tel: "电话",
610
+ save: "保存",
611
+ confirm: "确认",
612
+ cancel: "取消",
613
+ delete: "删除",
614
+ loading: "加载中...",
615
+ noCoupon: "暂无优惠券",
616
+ nameEmpty: "请填写姓名",
617
+ addContact: "添加联系人",
618
+ telInvalid: "请填写正确的电话",
619
619
  vanCalendar: {
620
- end: "\u7ED3\u675F",
621
- start: "\u5F00\u59CB",
622
- title: "\u65E5\u671F\u9009\u62E9",
623
- weekdays: ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"],
624
- monthTitle: (year, month) => `${year}\u5E74${month}\u6708`,
625
- rangePrompt: (maxRange) => `\u6700\u591A\u9009\u62E9 ${maxRange} \u5929`
620
+ end: "结束",
621
+ start: "开始",
622
+ title: "日期选择",
623
+ weekdays: ["", "", "", "", "", "", ""],
624
+ monthTitle: (year, month) => `${year}年${month}月`,
625
+ rangePrompt: (maxRange) => `最多选择 ${maxRange} 天`
626
626
  },
627
627
  vanCascader: {
628
- select: "\u8BF7\u9009\u62E9"
628
+ select: "请选择"
629
629
  },
630
630
  vanPagination: {
631
- prev: "\u4E0A\u4E00\u9875",
632
- next: "\u4E0B\u4E00\u9875"
631
+ prev: "上一页",
632
+ next: "下一页"
633
633
  },
634
634
  vanPullRefresh: {
635
- pulling: "\u4E0B\u62C9\u5373\u53EF\u5237\u65B0...",
636
- loosing: "\u91CA\u653E\u5373\u53EF\u5237\u65B0..."
635
+ pulling: "下拉即可刷新...",
636
+ loosing: "释放即可刷新..."
637
637
  },
638
638
  vanSubmitBar: {
639
- label: "\u5408\u8BA1:"
639
+ label: "合计:"
640
640
  },
641
641
  vanCoupon: {
642
- unlimited: "\u65E0\u95E8\u69DB",
643
- discount: (discount) => `${discount}\u6298`,
644
- condition: (condition) => `\u6EE1${condition}\u5143\u53EF\u7528`
642
+ unlimited: "无门槛",
643
+ discount: (discount) => `${discount}折`,
644
+ condition: (condition) => `满${condition}元可用`
645
645
  },
646
646
  vanCouponCell: {
647
- title: "\u4F18\u60E0\u5238",
648
- count: (count) => `${count}\u5F20\u53EF\u7528`
647
+ title: "优惠券",
648
+ count: (count) => `${count}张可用`
649
649
  },
650
650
  vanCouponList: {
651
- exchange: "\u5151\u6362",
652
- close: "\u4E0D\u4F7F\u7528",
653
- enable: "\u53EF\u7528",
654
- disabled: "\u4E0D\u53EF\u7528",
655
- placeholder: "\u8F93\u5165\u4F18\u60E0\u7801"
651
+ exchange: "兑换",
652
+ close: "不使用",
653
+ enable: "可用",
654
+ disabled: "不可用",
655
+ placeholder: "输入优惠码"
656
656
  },
657
657
  vanAddressEdit: {
658
- area: "\u5730\u533A",
659
- areaEmpty: "\u8BF7\u9009\u62E9\u5730\u533A",
660
- addressEmpty: "\u8BF7\u586B\u5199\u8BE6\u7EC6\u5730\u5740",
661
- addressDetail: "\u8BE6\u7EC6\u5730\u5740",
662
- defaultAddress: "\u8BBE\u4E3A\u9ED8\u8BA4\u6536\u8D27\u5730\u5740"
658
+ area: "地区",
659
+ areaEmpty: "请选择地区",
660
+ addressEmpty: "请填写详细地址",
661
+ addressDetail: "详细地址",
662
+ defaultAddress: "设为默认收货地址"
663
663
  },
664
664
  vanAddressList: {
665
- add: "\u65B0\u589E\u5730\u5740"
665
+ add: "新增地址"
666
666
  }
667
667
  };
668
668
  const lang = vue.ref("zh-CN");
@@ -913,18 +913,27 @@
913
913
  return content;
914
914
  }
915
915
  };
916
+ const getOffsetWithMinusString = (val) => val.startsWith("-") ? val.replace("-", "") : `-${val}`;
916
917
  const style = vue.computed(() => {
917
918
  const style2 = {
918
919
  background: props.color
919
920
  };
920
921
  if (props.offset) {
921
922
  const [x, y] = props.offset;
923
+ const {
924
+ position
925
+ } = props;
926
+ const [offsetY, offsetX] = position.split("-");
922
927
  if (slots.default) {
923
- style2.top = addUnit(y);
928
+ if (typeof y === "number") {
929
+ style2[offsetY] = addUnit(offsetY === "top" ? y : -y);
930
+ } else {
931
+ style2[offsetY] = offsetY === "top" ? addUnit(y) : getOffsetWithMinusString(y);
932
+ }
924
933
  if (typeof x === "number") {
925
- style2.right = addUnit(-x);
934
+ style2[offsetX] = addUnit(offsetX === "left" ? x : -x);
926
935
  } else {
927
- style2.right = x.startsWith("-") ? x.replace("-", "") : `-${x}`;
936
+ style2[offsetX] = offsetX === "left" ? addUnit(x) : getOffsetWithMinusString(x);
928
937
  }
929
938
  } else {
930
939
  style2.marginTop = addUnit(y);
@@ -4028,7 +4037,9 @@
4028
4037
  });
4029
4038
  };
4030
4039
  const getValues = () => children.reduce((form, field) => {
4031
- form[field.name] = field.formValue.value;
4040
+ if (field.name !== void 0) {
4041
+ form[field.name] = field.formValue.value;
4042
+ }
4032
4043
  return form;
4033
4044
  }, {});
4034
4045
  const submit = () => {
@@ -7030,7 +7041,7 @@
7030
7041
  price: numericProp,
7031
7042
  centered: Boolean,
7032
7043
  lazyLoad: Boolean,
7033
- currency: makeStringProp("\xA5"),
7044
+ currency: makeStringProp("¥"),
7034
7045
  thumbLink: String,
7035
7046
  originPrice: numericProp
7036
7047
  };
@@ -8049,7 +8060,7 @@
8049
8060
  if (props.type === "add") {
8050
8061
  return props.addText || t$d("addContact");
8051
8062
  }
8052
- return [vue.createVNode("div", null, [`${t$d("name")}\uFF1A${props.name}`]), vue.createVNode("div", null, [`${t$d("tel")}\uFF1A${props.tel}`])];
8063
+ return [vue.createVNode("div", null, [`${t$d("name")}:${props.name}`]), vue.createVNode("div", null, [`${t$d("tel")}:${props.tel}`])];
8053
8064
  };
8054
8065
  return () => vue.createVNode(Cell, {
8055
8066
  "center": true,
@@ -8200,7 +8211,7 @@
8200
8211
  }
8201
8212
  }, null);
8202
8213
  const renderContent = () => {
8203
- const nodes = [`${item.name}\uFF0C${item.tel}`];
8214
+ const nodes = [`${item.name},${item.tel}`];
8204
8215
  if (item.isDefault && props.defaultTagText) {
8205
8216
  nodes.push(vue.createVNode(Tag, {
8206
8217
  "type": "primary",
@@ -8343,7 +8354,7 @@
8343
8354
  chosen: Boolean,
8344
8355
  coupon: makeRequiredProp(Object),
8345
8356
  disabled: Boolean,
8346
- currency: makeStringProp("\xA5")
8357
+ currency: makeStringProp("¥")
8347
8358
  },
8348
8359
  setup(props) {
8349
8360
  const validPeriod = vue.computed(() => {
@@ -8415,7 +8426,7 @@
8415
8426
  border: truthProp,
8416
8427
  editable: truthProp,
8417
8428
  coupons: makeArrayProp(),
8418
- currency: makeStringProp("\xA5"),
8429
+ currency: makeStringProp("¥"),
8419
8430
  chosenCoupon: makeNumericProp(-1)
8420
8431
  };
8421
8432
  function formatValue({
@@ -8777,7 +8788,7 @@
8777
8788
  const couponListProps = {
8778
8789
  code: makeStringProp(""),
8779
8790
  coupons: makeArrayProp(),
8780
- currency: makeStringProp("\xA5"),
8791
+ currency: makeStringProp("¥"),
8781
8792
  showCount: truthProp,
8782
8793
  emptyImage: String,
8783
8794
  chosenCoupon: makeNumberProp(-1),
@@ -14357,7 +14368,7 @@
14357
14368
  price: Number,
14358
14369
  tipIcon: String,
14359
14370
  loading: Boolean,
14360
- currency: makeStringProp("\xA5"),
14371
+ currency: makeStringProp("¥"),
14361
14372
  disabled: Boolean,
14362
14373
  textAlign: String,
14363
14374
  buttonText: String,
@@ -16094,7 +16105,7 @@
16094
16105
  });
16095
16106
  }
16096
16107
  };
16097
- const version = "4.0.4";
16108
+ const version = "4.0.6";
16098
16109
  function install(app) {
16099
16110
  const components = [
16100
16111
  ActionBar,