vant 3.6.3 → 3.6.5

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
@@ -91,4 +91,4 @@ declare namespace _default {
91
91
  }
92
92
  export default _default;
93
93
  export function install(app: any): void;
94
- export const version: "3.6.3";
94
+ export const version: "3.6.5";
package/lib/index.js CHANGED
@@ -196,7 +196,7 @@ __reExport(stdin_exports, require("./tag"), module.exports);
196
196
  __reExport(stdin_exports, require("./toast"), module.exports);
197
197
  __reExport(stdin_exports, require("./tree-select"), module.exports);
198
198
  __reExport(stdin_exports, require("./uploader"), module.exports);
199
- const version = "3.6.3";
199
+ const version = "3.6.5";
200
200
  function install(app) {
201
201
  const components = [
202
202
  import_action_bar.ActionBar,
@@ -23,6 +23,7 @@ module.exports = __toCommonJS(stdin_exports);
23
23
  var import_use = require("@vant/use");
24
24
  var import_util = require("./util");
25
25
  var import_utils = require("../../utils");
26
+ var import_vue = require("vue");
26
27
  var stdin_default = (lazyManager) => ({
27
28
  props: {
28
29
  src: [String, Object],
@@ -31,15 +32,14 @@ var stdin_default = (lazyManager) => ({
31
32
  default: "img"
32
33
  }
33
34
  },
34
- render(h) {
35
- return h(
35
+ render() {
36
+ var _a, _b;
37
+ return (0, import_vue.h)(
36
38
  this.tag,
37
39
  {
38
- attrs: {
39
- src: this.renderSrc
40
- }
40
+ src: this.renderSrc
41
41
  },
42
- this.$slots.default
42
+ (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)
43
43
  );
44
44
  },
45
45
  data() {
package/lib/tabs/Tabs.js CHANGED
@@ -180,17 +180,19 @@ var stdin_default = (0, import_vue2.defineComponent)({
180
180
  const newTab = children[newIndex];
181
181
  const newName = getTabName(newTab, newIndex);
182
182
  const shouldEmitChange = state.currentIndex !== null;
183
- state.currentIndex = newIndex;
183
+ if (state.currentIndex !== newIndex) {
184
+ state.currentIndex = newIndex;
185
+ if (!skipScrollIntoView) {
186
+ scrollIntoView();
187
+ }
188
+ setLine();
189
+ }
184
190
  if (newName !== props.active) {
185
191
  emit("update:active", newName);
186
192
  if (shouldEmitChange) {
187
193
  emit("change", newName, newTab.title);
188
194
  }
189
195
  }
190
- if (!skipScrollIntoView) {
191
- scrollIntoView();
192
- }
193
- setLine();
194
196
  if (stickyFixed && !props.scrollspy) {
195
197
  (0, import_utils.setRootScrollTop)(Math.ceil((0, import_utils.getElementTop)(root.value) - offsetTopPx.value));
196
198
  }
@@ -292,13 +294,14 @@ var stdin_default = (0, import_vue2.defineComponent)({
292
294
  }
293
295
  };
294
296
  const renderHeader = () => {
295
- var _a2, _b2;
297
+ var _a2, _b2, _c;
296
298
  const {
297
299
  type,
298
- border
300
+ border,
301
+ sticky
299
302
  } = props;
300
- return (0, import_vue.createVNode)("div", {
301
- "ref": wrapRef,
303
+ const Header = [(0, import_vue.createVNode)("div", {
304
+ "ref": sticky ? void 0 : wrapRef,
302
305
  "class": [bem("wrap"), {
303
306
  [import_utils.BORDER_TOP_BOTTOM]: type === "line" && border
304
307
  }]
@@ -311,7 +314,13 @@ var stdin_default = (0, import_vue2.defineComponent)({
311
314
  }]),
312
315
  "style": navStyle.value,
313
316
  "aria-orientation": "horizontal"
314
- }, [(_a2 = slots["nav-left"]) == null ? void 0 : _a2.call(slots), renderNav(), renderLine(), (_b2 = slots["nav-right"]) == null ? void 0 : _b2.call(slots)])]);
317
+ }, [(_a2 = slots["nav-left"]) == null ? void 0 : _a2.call(slots), renderNav(), renderLine(), (_b2 = slots["nav-right"]) == null ? void 0 : _b2.call(slots)])]), (_c = slots["nav-bottom"]) == null ? void 0 : _c.call(slots)];
318
+ if (sticky) {
319
+ return (0, import_vue.createVNode)("div", {
320
+ "ref": wrapRef
321
+ }, [Header]);
322
+ }
323
+ return Header;
315
324
  };
316
325
  (0, import_vue2.watch)([() => props.color, import_utils.windowWidth], setLine);
317
326
  (0, import_vue2.watch)(() => props.active, (value) => {
@@ -365,36 +374,30 @@ var stdin_default = (0, import_vue2.defineComponent)({
365
374
  currentName,
366
375
  scrollIntoView
367
376
  });
368
- return () => {
369
- var _a2;
370
- return (0, import_vue.createVNode)("div", {
371
- "ref": root,
372
- "class": bem([props.type])
373
- }, [props.sticky ? (0, import_vue.createVNode)(import_sticky.Sticky, {
374
- "container": root.value,
375
- "offsetTop": offsetTopPx.value,
376
- "onScroll": onStickyScroll
377
- }, {
378
- default: () => {
379
- var _a3;
380
- return [renderHeader(), (_a3 = slots["nav-bottom"]) == null ? void 0 : _a3.call(slots)];
381
- }
382
- }) : [renderHeader(), (_a2 = slots["nav-bottom"]) == null ? void 0 : _a2.call(slots)], (0, import_vue.createVNode)(import_TabsContent.default, {
383
- "ref": contentRef,
384
- "count": children.length,
385
- "inited": state.inited,
386
- "animated": props.animated,
387
- "duration": props.duration,
388
- "swipeable": props.swipeable,
389
- "lazyRender": props.lazyRender,
390
- "currentIndex": state.currentIndex,
391
- "onChange": setCurrentIndex
392
- }, {
393
- default: () => {
394
- var _a3;
395
- return [(_a3 = slots.default) == null ? void 0 : _a3.call(slots)];
396
- }
397
- })]);
398
- };
377
+ return () => (0, import_vue.createVNode)("div", {
378
+ "ref": root,
379
+ "class": bem([props.type])
380
+ }, [props.sticky ? (0, import_vue.createVNode)(import_sticky.Sticky, {
381
+ "container": root.value,
382
+ "offsetTop": offsetTopPx.value,
383
+ "onScroll": onStickyScroll
384
+ }, {
385
+ default: () => [renderHeader()]
386
+ }) : renderHeader(), (0, import_vue.createVNode)(import_TabsContent.default, {
387
+ "ref": contentRef,
388
+ "count": children.length,
389
+ "inited": state.inited,
390
+ "animated": props.animated,
391
+ "duration": props.duration,
392
+ "swipeable": props.swipeable,
393
+ "lazyRender": props.lazyRender,
394
+ "currentIndex": state.currentIndex,
395
+ "onChange": setCurrentIndex
396
+ }, {
397
+ default: () => {
398
+ var _a2;
399
+ return [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)];
400
+ }
401
+ })]);
399
402
  }
400
403
  });
package/lib/vant.cjs.js CHANGED
@@ -6184,17 +6184,19 @@ var stdin_default$11 = vue.defineComponent({
6184
6184
  const newTab = children[newIndex];
6185
6185
  const newName = getTabName(newTab, newIndex);
6186
6186
  const shouldEmitChange = state.currentIndex !== null;
6187
- state.currentIndex = newIndex;
6187
+ if (state.currentIndex !== newIndex) {
6188
+ state.currentIndex = newIndex;
6189
+ if (!skipScrollIntoView) {
6190
+ scrollIntoView();
6191
+ }
6192
+ setLine();
6193
+ }
6188
6194
  if (newName !== props.active) {
6189
6195
  emit("update:active", newName);
6190
6196
  if (shouldEmitChange) {
6191
6197
  emit("change", newName, newTab.title);
6192
6198
  }
6193
6199
  }
6194
- if (!skipScrollIntoView) {
6195
- scrollIntoView();
6196
- }
6197
- setLine();
6198
6200
  if (stickyFixed && !props.scrollspy) {
6199
6201
  setRootScrollTop(Math.ceil(getElementTop(root.value) - offsetTopPx.value));
6200
6202
  }
@@ -6296,13 +6298,14 @@ var stdin_default$11 = vue.defineComponent({
6296
6298
  }
6297
6299
  };
6298
6300
  const renderHeader = () => {
6299
- var _a2, _b2;
6301
+ var _a2, _b2, _c;
6300
6302
  const {
6301
6303
  type,
6302
- border
6304
+ border,
6305
+ sticky
6303
6306
  } = props;
6304
- return vue.createVNode("div", {
6305
- "ref": wrapRef,
6307
+ const Header = [vue.createVNode("div", {
6308
+ "ref": sticky ? void 0 : wrapRef,
6306
6309
  "class": [bem$W("wrap"), {
6307
6310
  [BORDER_TOP_BOTTOM]: type === "line" && border
6308
6311
  }]
@@ -6315,7 +6318,13 @@ var stdin_default$11 = vue.defineComponent({
6315
6318
  }]),
6316
6319
  "style": navStyle.value,
6317
6320
  "aria-orientation": "horizontal"
6318
- }, [(_a2 = slots["nav-left"]) == null ? void 0 : _a2.call(slots), renderNav(), renderLine(), (_b2 = slots["nav-right"]) == null ? void 0 : _b2.call(slots)])]);
6321
+ }, [(_a2 = slots["nav-left"]) == null ? void 0 : _a2.call(slots), renderNav(), renderLine(), (_b2 = slots["nav-right"]) == null ? void 0 : _b2.call(slots)])]), (_c = slots["nav-bottom"]) == null ? void 0 : _c.call(slots)];
6322
+ if (sticky) {
6323
+ return vue.createVNode("div", {
6324
+ "ref": wrapRef
6325
+ }, [Header]);
6326
+ }
6327
+ return Header;
6319
6328
  };
6320
6329
  vue.watch([() => props.color, windowWidth], setLine);
6321
6330
  vue.watch(() => props.active, (value) => {
@@ -6369,37 +6378,31 @@ var stdin_default$11 = vue.defineComponent({
6369
6378
  currentName,
6370
6379
  scrollIntoView
6371
6380
  });
6372
- return () => {
6373
- var _a2;
6374
- return vue.createVNode("div", {
6375
- "ref": root,
6376
- "class": bem$W([props.type])
6377
- }, [props.sticky ? vue.createVNode(Sticky, {
6378
- "container": root.value,
6379
- "offsetTop": offsetTopPx.value,
6380
- "onScroll": onStickyScroll
6381
- }, {
6382
- default: () => {
6383
- var _a3;
6384
- return [renderHeader(), (_a3 = slots["nav-bottom"]) == null ? void 0 : _a3.call(slots)];
6385
- }
6386
- }) : [renderHeader(), (_a2 = slots["nav-bottom"]) == null ? void 0 : _a2.call(slots)], vue.createVNode(stdin_default$12, {
6387
- "ref": contentRef,
6388
- "count": children.length,
6389
- "inited": state.inited,
6390
- "animated": props.animated,
6391
- "duration": props.duration,
6392
- "swipeable": props.swipeable,
6393
- "lazyRender": props.lazyRender,
6394
- "currentIndex": state.currentIndex,
6395
- "onChange": setCurrentIndex
6396
- }, {
6397
- default: () => {
6398
- var _a3;
6399
- return [(_a3 = slots.default) == null ? void 0 : _a3.call(slots)];
6400
- }
6401
- })]);
6402
- };
6381
+ return () => vue.createVNode("div", {
6382
+ "ref": root,
6383
+ "class": bem$W([props.type])
6384
+ }, [props.sticky ? vue.createVNode(Sticky, {
6385
+ "container": root.value,
6386
+ "offsetTop": offsetTopPx.value,
6387
+ "onScroll": onStickyScroll
6388
+ }, {
6389
+ default: () => [renderHeader()]
6390
+ }) : renderHeader(), vue.createVNode(stdin_default$12, {
6391
+ "ref": contentRef,
6392
+ "count": children.length,
6393
+ "inited": state.inited,
6394
+ "animated": props.animated,
6395
+ "duration": props.duration,
6396
+ "swipeable": props.swipeable,
6397
+ "lazyRender": props.lazyRender,
6398
+ "currentIndex": state.currentIndex,
6399
+ "onChange": setCurrentIndex
6400
+ }, {
6401
+ default: () => {
6402
+ var _a2;
6403
+ return [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)];
6404
+ }
6405
+ })]);
6403
6406
  }
6404
6407
  });
6405
6408
  const TAB_STATUS_KEY = Symbol();
@@ -9593,7 +9596,8 @@ var stdin_default$A = vue.defineComponent({
9593
9596
  },
9594
9597
  emits: ["scale", "close"],
9595
9598
  setup(props, {
9596
- emit
9599
+ emit,
9600
+ slots
9597
9601
  }) {
9598
9602
  const state = vue.reactive({
9599
9603
  scale: 1,
@@ -9811,7 +9815,11 @@ var stdin_default$A = vue.defineComponent({
9811
9815
  "onTouchend": onTouchEnd,
9812
9816
  "onTouchcancel": onTouchEnd
9813
9817
  }, {
9814
- default: () => [vue.createVNode(Image$1, {
9818
+ default: () => [slots.image ? vue.createVNode("div", {
9819
+ "class": bem$v("image-wrap")
9820
+ }, [slots.image({
9821
+ src: props.src
9822
+ })]) : vue.createVNode(Image$1, {
9815
9823
  "src": props.src,
9816
9824
  "fit": "contain",
9817
9825
  "class": bem$v("image", {
@@ -9920,7 +9928,9 @@ var stdin_default$z = vue.defineComponent({
9920
9928
  "rootHeight": state.rootHeight,
9921
9929
  "onScale": emitScale,
9922
9930
  "onClose": emitClose
9923
- }, null))]
9931
+ }, {
9932
+ image: slots.image
9933
+ }))]
9924
9934
  });
9925
9935
  const renderClose = () => {
9926
9936
  if (props.closeable) {
@@ -14835,15 +14845,14 @@ var stdin_default$1 = (lazyManager) => ({
14835
14845
  default: "img"
14836
14846
  }
14837
14847
  },
14838
- render(h) {
14839
- return h(
14848
+ render() {
14849
+ var _a, _b;
14850
+ return vue.h(
14840
14851
  this.tag,
14841
14852
  {
14842
- attrs: {
14843
- src: this.renderSrc
14844
- }
14853
+ src: this.renderSrc
14845
14854
  },
14846
- this.$slots.default
14855
+ (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)
14847
14856
  );
14848
14857
  },
14849
14858
  data() {
@@ -14945,7 +14954,7 @@ const Lazyload = {
14945
14954
  });
14946
14955
  }
14947
14956
  };
14948
- const version = "3.6.3";
14957
+ const version = "3.6.5";
14949
14958
  function install(app) {
14950
14959
  const components = [
14951
14960
  ActionBar,
package/lib/vant.es.js CHANGED
@@ -6182,17 +6182,19 @@ var stdin_default$11 = defineComponent({
6182
6182
  const newTab = children[newIndex];
6183
6183
  const newName = getTabName(newTab, newIndex);
6184
6184
  const shouldEmitChange = state.currentIndex !== null;
6185
- state.currentIndex = newIndex;
6185
+ if (state.currentIndex !== newIndex) {
6186
+ state.currentIndex = newIndex;
6187
+ if (!skipScrollIntoView) {
6188
+ scrollIntoView();
6189
+ }
6190
+ setLine();
6191
+ }
6186
6192
  if (newName !== props.active) {
6187
6193
  emit("update:active", newName);
6188
6194
  if (shouldEmitChange) {
6189
6195
  emit("change", newName, newTab.title);
6190
6196
  }
6191
6197
  }
6192
- if (!skipScrollIntoView) {
6193
- scrollIntoView();
6194
- }
6195
- setLine();
6196
6198
  if (stickyFixed && !props.scrollspy) {
6197
6199
  setRootScrollTop(Math.ceil(getElementTop(root.value) - offsetTopPx.value));
6198
6200
  }
@@ -6294,13 +6296,14 @@ var stdin_default$11 = defineComponent({
6294
6296
  }
6295
6297
  };
6296
6298
  const renderHeader = () => {
6297
- var _a2, _b2;
6299
+ var _a2, _b2, _c;
6298
6300
  const {
6299
6301
  type,
6300
- border
6302
+ border,
6303
+ sticky
6301
6304
  } = props;
6302
- return createVNode("div", {
6303
- "ref": wrapRef,
6305
+ const Header = [createVNode("div", {
6306
+ "ref": sticky ? void 0 : wrapRef,
6304
6307
  "class": [bem$W("wrap"), {
6305
6308
  [BORDER_TOP_BOTTOM]: type === "line" && border
6306
6309
  }]
@@ -6313,7 +6316,13 @@ var stdin_default$11 = defineComponent({
6313
6316
  }]),
6314
6317
  "style": navStyle.value,
6315
6318
  "aria-orientation": "horizontal"
6316
- }, [(_a2 = slots["nav-left"]) == null ? void 0 : _a2.call(slots), renderNav(), renderLine(), (_b2 = slots["nav-right"]) == null ? void 0 : _b2.call(slots)])]);
6319
+ }, [(_a2 = slots["nav-left"]) == null ? void 0 : _a2.call(slots), renderNav(), renderLine(), (_b2 = slots["nav-right"]) == null ? void 0 : _b2.call(slots)])]), (_c = slots["nav-bottom"]) == null ? void 0 : _c.call(slots)];
6320
+ if (sticky) {
6321
+ return createVNode("div", {
6322
+ "ref": wrapRef
6323
+ }, [Header]);
6324
+ }
6325
+ return Header;
6317
6326
  };
6318
6327
  watch([() => props.color, windowWidth], setLine);
6319
6328
  watch(() => props.active, (value) => {
@@ -6367,37 +6376,31 @@ var stdin_default$11 = defineComponent({
6367
6376
  currentName,
6368
6377
  scrollIntoView
6369
6378
  });
6370
- return () => {
6371
- var _a2;
6372
- return createVNode("div", {
6373
- "ref": root,
6374
- "class": bem$W([props.type])
6375
- }, [props.sticky ? createVNode(Sticky, {
6376
- "container": root.value,
6377
- "offsetTop": offsetTopPx.value,
6378
- "onScroll": onStickyScroll
6379
- }, {
6380
- default: () => {
6381
- var _a3;
6382
- return [renderHeader(), (_a3 = slots["nav-bottom"]) == null ? void 0 : _a3.call(slots)];
6383
- }
6384
- }) : [renderHeader(), (_a2 = slots["nav-bottom"]) == null ? void 0 : _a2.call(slots)], createVNode(stdin_default$12, {
6385
- "ref": contentRef,
6386
- "count": children.length,
6387
- "inited": state.inited,
6388
- "animated": props.animated,
6389
- "duration": props.duration,
6390
- "swipeable": props.swipeable,
6391
- "lazyRender": props.lazyRender,
6392
- "currentIndex": state.currentIndex,
6393
- "onChange": setCurrentIndex
6394
- }, {
6395
- default: () => {
6396
- var _a3;
6397
- return [(_a3 = slots.default) == null ? void 0 : _a3.call(slots)];
6398
- }
6399
- })]);
6400
- };
6379
+ return () => createVNode("div", {
6380
+ "ref": root,
6381
+ "class": bem$W([props.type])
6382
+ }, [props.sticky ? createVNode(Sticky, {
6383
+ "container": root.value,
6384
+ "offsetTop": offsetTopPx.value,
6385
+ "onScroll": onStickyScroll
6386
+ }, {
6387
+ default: () => [renderHeader()]
6388
+ }) : renderHeader(), createVNode(stdin_default$12, {
6389
+ "ref": contentRef,
6390
+ "count": children.length,
6391
+ "inited": state.inited,
6392
+ "animated": props.animated,
6393
+ "duration": props.duration,
6394
+ "swipeable": props.swipeable,
6395
+ "lazyRender": props.lazyRender,
6396
+ "currentIndex": state.currentIndex,
6397
+ "onChange": setCurrentIndex
6398
+ }, {
6399
+ default: () => {
6400
+ var _a2;
6401
+ return [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)];
6402
+ }
6403
+ })]);
6401
6404
  }
6402
6405
  });
6403
6406
  const TAB_STATUS_KEY = Symbol();
@@ -9591,7 +9594,8 @@ var stdin_default$A = defineComponent({
9591
9594
  },
9592
9595
  emits: ["scale", "close"],
9593
9596
  setup(props, {
9594
- emit
9597
+ emit,
9598
+ slots
9595
9599
  }) {
9596
9600
  const state = reactive({
9597
9601
  scale: 1,
@@ -9809,7 +9813,11 @@ var stdin_default$A = defineComponent({
9809
9813
  "onTouchend": onTouchEnd,
9810
9814
  "onTouchcancel": onTouchEnd
9811
9815
  }, {
9812
- default: () => [createVNode(Image$1, {
9816
+ default: () => [slots.image ? createVNode("div", {
9817
+ "class": bem$v("image-wrap")
9818
+ }, [slots.image({
9819
+ src: props.src
9820
+ })]) : createVNode(Image$1, {
9813
9821
  "src": props.src,
9814
9822
  "fit": "contain",
9815
9823
  "class": bem$v("image", {
@@ -9918,7 +9926,9 @@ var stdin_default$z = defineComponent({
9918
9926
  "rootHeight": state.rootHeight,
9919
9927
  "onScale": emitScale,
9920
9928
  "onClose": emitClose
9921
- }, null))]
9929
+ }, {
9930
+ image: slots.image
9931
+ }))]
9922
9932
  });
9923
9933
  const renderClose = () => {
9924
9934
  if (props.closeable) {
@@ -14833,15 +14843,14 @@ var stdin_default$1 = (lazyManager) => ({
14833
14843
  default: "img"
14834
14844
  }
14835
14845
  },
14836
- render(h2) {
14837
- return h2(
14846
+ render() {
14847
+ var _a, _b;
14848
+ return h(
14838
14849
  this.tag,
14839
14850
  {
14840
- attrs: {
14841
- src: this.renderSrc
14842
- }
14851
+ src: this.renderSrc
14843
14852
  },
14844
- this.$slots.default
14853
+ (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)
14845
14854
  );
14846
14855
  },
14847
14856
  data() {
@@ -14943,7 +14952,7 @@ const Lazyload = {
14943
14952
  });
14944
14953
  }
14945
14954
  };
14946
- const version = "3.6.3";
14955
+ const version = "3.6.5";
14947
14956
  function install(app) {
14948
14957
  const components = [
14949
14958
  ActionBar,