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/vant.js CHANGED
@@ -6530,17 +6530,19 @@
6530
6530
  const newTab = children[newIndex];
6531
6531
  const newName = getTabName(newTab, newIndex);
6532
6532
  const shouldEmitChange = state.currentIndex !== null;
6533
- state.currentIndex = newIndex;
6533
+ if (state.currentIndex !== newIndex) {
6534
+ state.currentIndex = newIndex;
6535
+ if (!skipScrollIntoView) {
6536
+ scrollIntoView();
6537
+ }
6538
+ setLine();
6539
+ }
6534
6540
  if (newName !== props.active) {
6535
6541
  emit("update:active", newName);
6536
6542
  if (shouldEmitChange) {
6537
6543
  emit("change", newName, newTab.title);
6538
6544
  }
6539
6545
  }
6540
- if (!skipScrollIntoView) {
6541
- scrollIntoView();
6542
- }
6543
- setLine();
6544
6546
  if (stickyFixed && !props.scrollspy) {
6545
6547
  setRootScrollTop(Math.ceil(getElementTop(root.value) - offsetTopPx.value));
6546
6548
  }
@@ -6642,13 +6644,14 @@
6642
6644
  }
6643
6645
  };
6644
6646
  const renderHeader = () => {
6645
- var _a2, _b2;
6647
+ var _a2, _b2, _c;
6646
6648
  const {
6647
6649
  type,
6648
- border
6650
+ border,
6651
+ sticky
6649
6652
  } = props;
6650
- return vue.createVNode("div", {
6651
- "ref": wrapRef,
6653
+ const Header = [vue.createVNode("div", {
6654
+ "ref": sticky ? void 0 : wrapRef,
6652
6655
  "class": [bem$W("wrap"), {
6653
6656
  [BORDER_TOP_BOTTOM]: type === "line" && border
6654
6657
  }]
@@ -6661,7 +6664,13 @@
6661
6664
  }]),
6662
6665
  "style": navStyle.value,
6663
6666
  "aria-orientation": "horizontal"
6664
- }, [(_a2 = slots["nav-left"]) == null ? void 0 : _a2.call(slots), renderNav(), renderLine(), (_b2 = slots["nav-right"]) == null ? void 0 : _b2.call(slots)])]);
6667
+ }, [(_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)];
6668
+ if (sticky) {
6669
+ return vue.createVNode("div", {
6670
+ "ref": wrapRef
6671
+ }, [Header]);
6672
+ }
6673
+ return Header;
6665
6674
  };
6666
6675
  vue.watch([() => props.color, windowWidth], setLine);
6667
6676
  vue.watch(() => props.active, (value) => {
@@ -6715,37 +6724,31 @@
6715
6724
  currentName,
6716
6725
  scrollIntoView
6717
6726
  });
6718
- return () => {
6719
- var _a2;
6720
- return vue.createVNode("div", {
6721
- "ref": root,
6722
- "class": bem$W([props.type])
6723
- }, [props.sticky ? vue.createVNode(Sticky, {
6724
- "container": root.value,
6725
- "offsetTop": offsetTopPx.value,
6726
- "onScroll": onStickyScroll
6727
- }, {
6728
- default: () => {
6729
- var _a3;
6730
- return [renderHeader(), (_a3 = slots["nav-bottom"]) == null ? void 0 : _a3.call(slots)];
6731
- }
6732
- }) : [renderHeader(), (_a2 = slots["nav-bottom"]) == null ? void 0 : _a2.call(slots)], vue.createVNode(stdin_default$12, {
6733
- "ref": contentRef,
6734
- "count": children.length,
6735
- "inited": state.inited,
6736
- "animated": props.animated,
6737
- "duration": props.duration,
6738
- "swipeable": props.swipeable,
6739
- "lazyRender": props.lazyRender,
6740
- "currentIndex": state.currentIndex,
6741
- "onChange": setCurrentIndex
6742
- }, {
6743
- default: () => {
6744
- var _a3;
6745
- return [(_a3 = slots.default) == null ? void 0 : _a3.call(slots)];
6746
- }
6747
- })]);
6748
- };
6727
+ return () => vue.createVNode("div", {
6728
+ "ref": root,
6729
+ "class": bem$W([props.type])
6730
+ }, [props.sticky ? vue.createVNode(Sticky, {
6731
+ "container": root.value,
6732
+ "offsetTop": offsetTopPx.value,
6733
+ "onScroll": onStickyScroll
6734
+ }, {
6735
+ default: () => [renderHeader()]
6736
+ }) : renderHeader(), vue.createVNode(stdin_default$12, {
6737
+ "ref": contentRef,
6738
+ "count": children.length,
6739
+ "inited": state.inited,
6740
+ "animated": props.animated,
6741
+ "duration": props.duration,
6742
+ "swipeable": props.swipeable,
6743
+ "lazyRender": props.lazyRender,
6744
+ "currentIndex": state.currentIndex,
6745
+ "onChange": setCurrentIndex
6746
+ }, {
6747
+ default: () => {
6748
+ var _a2;
6749
+ return [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)];
6750
+ }
6751
+ })]);
6749
6752
  }
6750
6753
  });
6751
6754
  const TAB_STATUS_KEY = Symbol();
@@ -9910,7 +9913,8 @@
9910
9913
  },
9911
9914
  emits: ["scale", "close"],
9912
9915
  setup(props, {
9913
- emit
9916
+ emit,
9917
+ slots
9914
9918
  }) {
9915
9919
  const state = vue.reactive({
9916
9920
  scale: 1,
@@ -10128,7 +10132,11 @@
10128
10132
  "onTouchend": onTouchEnd,
10129
10133
  "onTouchcancel": onTouchEnd
10130
10134
  }, {
10131
- default: () => [vue.createVNode(Image$1, {
10135
+ default: () => [slots.image ? vue.createVNode("div", {
10136
+ "class": bem$v("image-wrap")
10137
+ }, [slots.image({
10138
+ src: props.src
10139
+ })]) : vue.createVNode(Image$1, {
10132
10140
  "src": props.src,
10133
10141
  "fit": "contain",
10134
10142
  "class": bem$v("image", {
@@ -10237,7 +10245,9 @@
10237
10245
  "rootHeight": state.rootHeight,
10238
10246
  "onScale": emitScale,
10239
10247
  "onClose": emitClose
10240
- }, null))]
10248
+ }, {
10249
+ image: slots.image
10250
+ }))]
10241
10251
  });
10242
10252
  const renderClose = () => {
10243
10253
  if (props.closeable) {
@@ -16037,15 +16047,14 @@
16037
16047
  default: "img"
16038
16048
  }
16039
16049
  },
16040
- render(h) {
16041
- return h(
16050
+ render() {
16051
+ var _a, _b;
16052
+ return vue.h(
16042
16053
  this.tag,
16043
16054
  {
16044
- attrs: {
16045
- src: this.renderSrc
16046
- }
16055
+ src: this.renderSrc
16047
16056
  },
16048
- this.$slots.default
16057
+ (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)
16049
16058
  );
16050
16059
  },
16051
16060
  data() {
@@ -16142,7 +16151,7 @@
16142
16151
  });
16143
16152
  }
16144
16153
  };
16145
- const version = "3.6.3";
16154
+ const version = "3.6.5";
16146
16155
  function install(app) {
16147
16156
  const components = [
16148
16157
  ActionBar,