@deot/vc-components 1.0.47 → 1.0.49

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/dist/index.cjs CHANGED
@@ -128,6 +128,10 @@ const ActionSheet = /* @__PURE__ */ vue.defineComponent({
128
128
  const MActionSheet = ActionSheet;
129
129
 
130
130
  const props$1s = {
131
+ modelValue: {
132
+ type: Boolean,
133
+ default: false
134
+ },
131
135
  zIndex: {
132
136
  type: [Number, String],
133
137
  default: 1
@@ -155,16 +159,45 @@ const props$1s = {
155
159
  }
156
160
  };
157
161
 
162
+ let scrollBarWidth;
163
+ const getScrollBarWidth = () => {
164
+ if (scrollBarWidth !== void 0) return scrollBarWidth;
165
+ const outer = document.createElement("div");
166
+ outer.className = "vc-scrollbar__wrap";
167
+ outer.style.visibility = "hidden";
168
+ outer.style.width = "100px";
169
+ outer.style.position = "absolute";
170
+ outer.style.top = "-9999px";
171
+ document.body.appendChild(outer);
172
+ const widthNoScroll = outer.offsetWidth;
173
+ outer.style.overflow = "scroll";
174
+ const inner = document.createElement("div");
175
+ inner.style.width = "100%";
176
+ outer.appendChild(inner);
177
+ const widthWithScroll = inner.offsetWidth;
178
+ outer.parentNode?.removeChild?.(outer);
179
+ scrollBarWidth = widthNoScroll - widthWithScroll;
180
+ return scrollBarWidth;
181
+ };
182
+ const SCROLLER_WHEEL_REG = /vc-scroller-wheel/;
183
+ const getScroller = (el) => {
184
+ return $.getScroller(el, { className: SCROLLER_WHEEL_REG });
185
+ };
186
+ const isWheel = (el) => {
187
+ return SCROLLER_WHEEL_REG.test(el?.className || "");
188
+ };
189
+
158
190
  /** @jsxImportSource vue */
159
191
 
160
192
  const COMPONENT_NAME$27 = 'vc-affix';
161
- const SCROLLER_WHEEL_REG = /vc-scroller-wheel/;
162
193
  const Affix = /* @__PURE__ */ vue.defineComponent({
163
194
  name: COMPONENT_NAME$27,
195
+ emits: ['update:modelValue'],
164
196
  props: props$1s,
165
197
  setup(props, {
166
198
  slots,
167
- expose
199
+ expose,
200
+ emit
168
201
  }) {
169
202
  const scrollerInstance = vue.inject('vc-scroller', null);
170
203
  const scroller = vue.shallowRef(); // 当前元素所在的滚动容器
@@ -180,9 +213,7 @@ const Affix = /* @__PURE__ */ vue.defineComponent({
180
213
  const isActive = vue.ref(false);
181
214
  const transformY = vue.ref(0);
182
215
  const windowHeight = vue.ref(window.innerHeight);
183
- const isVcScrollerWheel = vue.computed(() => {
184
- return SCROLLER_WHEEL_REG.test(scroller.value?.className || '');
185
- });
216
+ const isVcScrollerWheel = vue.computed(() => isWheel(scroller.value));
186
217
  const currentStyle = vue.computed(() => {
187
218
  if (!isActive.value) return {};
188
219
  return {
@@ -203,7 +234,8 @@ const Affix = /* @__PURE__ */ vue.defineComponent({
203
234
  };
204
235
  });
205
236
  const setCurrentRect = () => {
206
- const rect = current.value.getBoundingClientRect();
237
+ const rect = current.value?.getBoundingClientRect?.();
238
+ if (!rect) return;
207
239
  Object.assign(currentRect, {
208
240
  top: rect.top,
209
241
  bottom: rect.bottom,
@@ -230,7 +262,7 @@ const Affix = /* @__PURE__ */ vue.defineComponent({
230
262
  transformY.value = Math.min(containerRect.bottom - currentHeightOffset, 0) + transformOffsetY;
231
263
  } else {
232
264
  isActive.value = currentRect.bottom - containerRect.top >= containerRect.height - props.offset;
233
- transformY.value = Math.max(containerRect.height - containerRect.top - currentHeightOffset, 0) + transformOffsetY;
265
+ transformY.value = transformOffsetY;
234
266
  }
235
267
  };
236
268
  const setFixedStatus = () => {
@@ -257,36 +289,58 @@ const Affix = /* @__PURE__ */ vue.defineComponent({
257
289
  }
258
290
  }
259
291
  };
292
+ const offScroll = handler => {
293
+ if (isVcScrollerWheel.value) {
294
+ scrollerInstance?.off(handler);
295
+ } else {
296
+ scroller.value?.removeEventListener('scroll', handler);
297
+ }
298
+ };
299
+ const onScroll = (handler, options) => {
300
+ // nextTick目的在与onMounted后执行
301
+ vue.nextTick(() => {
302
+ if (isVcScrollerWheel.value) {
303
+ scrollerInstance?.on(handler);
304
+ } else {
305
+ scroller.value?.addEventListener('scroll', handler);
306
+ }
307
+ options?.first && handler();
308
+ });
309
+ return () => offScroll(handler);
310
+ };
260
311
  const refresh = () => {
312
+ if (props.disabled) return;
261
313
  setCurrentRect();
262
314
  scroller.value instanceof Window || props.fixed ? setFixedStatus() : setAbsoluteStatus();
315
+ emit('update:modelValue', isActive.value);
263
316
  };
264
317
  vue.onMounted(() => {
265
318
  if (typeof props.target === 'string') {
266
319
  base.value = document.querySelector(props.target) ?? void 0;
267
320
  }
268
321
  !base.value && (base.value = document.documentElement);
269
- scroller.value = $.getScroller(current.value, {
270
- className: SCROLLER_WHEEL_REG
322
+ scroller.value = getScroller(current.value);
323
+ onScroll(refresh, {
324
+ first: true
271
325
  });
272
- if (isVcScrollerWheel.value) {
273
- scrollerInstance?.on(refresh);
274
- } else {
275
- scroller.value?.addEventListener('scroll', refresh);
276
- }
277
- refresh();
278
- });
279
- vue.onBeforeUnmount(() => {
280
- if (isVcScrollerWheel.value) {
281
- scrollerInstance?.off(refresh);
282
- } else {
283
- scroller.value?.removeEventListener('scroll', refresh);
284
- }
285
326
  });
327
+ vue.onBeforeUnmount(() => offScroll(refresh));
286
328
  expose({
287
- refresh
329
+ refresh,
330
+ onScroll,
331
+ offScroll
332
+ });
333
+ vue.provide('vc-affix', {
334
+ props,
335
+ isActive,
336
+ refresh,
337
+ onScroll,
338
+ offScroll
288
339
  });
289
340
  return () => {
341
+ if (props.disabled) return slots?.default?.({
342
+ active: false
343
+ });
290
344
  return vue.createVNode("div", {
291
345
  "ref": current,
292
346
  "class": "vc-affix",
@@ -8863,27 +8917,6 @@ const props$T = {
8863
8917
  }
8864
8918
  };
8865
8919
 
8866
- let scrollBarWidth;
8867
- const getScrollBarWidth = () => {
8868
- if (scrollBarWidth !== void 0) return scrollBarWidth;
8869
- const outer = document.createElement("div");
8870
- outer.className = "vc-scrollbar__wrap";
8871
- outer.style.visibility = "hidden";
8872
- outer.style.width = "100px";
8873
- outer.style.position = "absolute";
8874
- outer.style.top = "-9999px";
8875
- document.body.appendChild(outer);
8876
- const widthNoScroll = outer.offsetWidth;
8877
- outer.style.overflow = "scroll";
8878
- const inner = document.createElement("div");
8879
- inner.style.width = "100%";
8880
- outer.appendChild(inner);
8881
- const widthWithScroll = inner.offsetWidth;
8882
- outer.parentNode?.removeChild?.(outer);
8883
- scrollBarWidth = widthNoScroll - widthWithScroll;
8884
- return scrollBarWidth;
8885
- };
8886
-
8887
8920
  const barKeys$1 = [
8888
8921
  "always",
8889
8922
  "thumbMinSize",
@@ -11455,7 +11488,14 @@ const props$L = {
11455
11488
  labelStyle: [Object, String],
11456
11489
  labelClass: [Object, String],
11457
11490
  errorStyle: [Object, String],
11458
- errorClass: [Object, String]
11491
+ errorClass: [Object, String],
11492
+ // 给nestFormItem统一注入
11493
+ nestedContentStyle: [Object, String],
11494
+ nestedContentClass: [Object, String],
11495
+ nestedLabelStyle: [Object, String],
11496
+ nestedLabelClass: [Object, String],
11497
+ nestedErrorStyle: [Object, String],
11498
+ nestedErrorClass: [Object, String]
11459
11499
  };
11460
11500
 
11461
11501
  const useForm = (expose, options = {}) => {
@@ -11675,31 +11715,32 @@ const useFormItem = (expose) => {
11675
11715
  });
11676
11716
  const classes = vue.computed(() => {
11677
11717
  return {
11678
- "is-require": isRequired.value && props.asterisk,
11718
+ "is-required": isRequired.value && props.asterisk,
11679
11719
  "is-error": validateState.value === "error",
11680
11720
  "is-validating": validateState.value === "validating",
11681
11721
  "is-inline": form.props.inline,
11682
- "is-nest": isNest.value,
11722
+ "is-nested": isNested.value,
11683
11723
  "is-alone": !props.showMessage,
11684
11724
  // 用于单独去除form-item的默认margin_bottom
11685
11725
  [`is-${labelPosition.value}`]: true
11686
11726
  };
11687
11727
  });
11688
- const isNest = vue.computed(() => {
11728
+ const isNested = vue.computed(() => {
11689
11729
  return !!formItem.change;
11690
11730
  });
11691
- const isNestLast = vue.ref(false);
11731
+ const isNestedLast = vue.ref(false);
11692
11732
  const hasLabel = vue.computed(() => {
11693
11733
  return !!props.label || slots.label;
11694
11734
  });
11695
11735
  const labelStyle = vue.computed(() => {
11696
- const labelWidth = props.labelWidth === 0 || props.labelWidth ? props.labelWidth : isNest.value ? 0 : form.props.labelWidth;
11736
+ const labelWidth = props.labelWidth === 0 || props.labelWidth ? props.labelWidth : isNested.value ? 0 : form.props.labelWidth;
11697
11737
  return [
11698
11738
  {
11699
11739
  width: labelPosition.value !== "top" && labelWidth && labelWidth > 0 ? `${labelWidth}px` : "auto",
11700
11740
  textAlign: labelPosition.value === "top" ? "left" : labelPosition.value
11701
11741
  },
11702
11742
  form.props.labelStyle,
11743
+ isNested.value && form.props.nestedLabelStyle,
11703
11744
  props.labelStyle
11704
11745
  ];
11705
11746
  });
@@ -11707,24 +11748,25 @@ const useFormItem = (expose) => {
11707
11748
  const labelWidth = props.labelWidth === 0 || props.labelWidth ? props.labelWidth : form.props.labelWidth;
11708
11749
  return [
11709
11750
  {
11710
- marginLeft: !hasLabel.value && isNest.value ? 0 : labelWidth && labelWidth > 0 ? `${labelWidth}px` : "unset",
11711
- marginBottom: isNest.value && !isNestLast.value ? `20px` : 0
11751
+ marginLeft: labelPosition.value === "top" || !hasLabel.value && isNested.value ? 0 : labelWidth && labelWidth > 0 ? `${labelWidth}px` : "unset",
11752
+ marginBottom: isNested.value && !isNestedLast.value ? `20px` : 0
11712
11753
  },
11713
11754
  form.props.contentStyle,
11755
+ isNested.value && form.props.nestedContentStyle,
11714
11756
  props.contentStyle
11715
11757
  ];
11716
11758
  });
11717
11759
  const errorStyle = vue.computed(() => {
11718
- return [form.props.errorStyle, props.errorStyle];
11760
+ return [form.props.errorStyle, isNested.value && form.props.nestedErrorStyle, props.errorStyle];
11719
11761
  });
11720
11762
  const labelClass = vue.computed(() => {
11721
- return [form.props.labelClass, props.labelClass];
11763
+ return [form.props.labelClass, isNested.value && form.props.nestedLabelClass, props.labelClass];
11722
11764
  });
11723
11765
  const contentClass = vue.computed(() => {
11724
- return [form.props.contentClass, props.contentClass];
11766
+ return [form.props.contentClass, isNested.value && form.props.nestedContentClass, props.contentClass];
11725
11767
  });
11726
11768
  const errorClass = vue.computed(() => {
11727
- return [form.props.errorClass, props.errorClass];
11769
+ return [form.props.errorClass, isNested.value && form.props.nestedErrorClass, props.errorClass];
11728
11770
  });
11729
11771
  const isStyleless = vue.computed(() => {
11730
11772
  return props.styleless || form.props.styleless;
@@ -11861,7 +11903,7 @@ const useFormItem = (expose) => {
11861
11903
  vue.watch(
11862
11904
  () => formItem.fields?.length,
11863
11905
  async (v) => {
11864
- if (!isNest.value || !v) return isNestLast.value = false;
11906
+ if (!isNested.value || !v) return isNestedLast.value = false;
11865
11907
  const fields$ = [...vue.toRaw(formItem.fields)];
11866
11908
  const positions = await Promise.all(fields$.map((item) => item.exposed.getPosition()));
11867
11909
  const sortFields = fields$.toSorted((a, b) => {
@@ -11872,7 +11914,7 @@ const useFormItem = (expose) => {
11872
11914
  if (aPosition.top != bPosition.top) return aPosition.top - bPosition.top;
11873
11915
  return aPosition.left - bPosition.left;
11874
11916
  });
11875
- isNestLast.value = sortFields[sortFields.length - 1] === instance;
11917
+ isNestedLast.value = sortFields[sortFields.length - 1] === instance;
11876
11918
  }
11877
11919
  );
11878
11920
  expose({
@@ -11881,9 +11923,9 @@ const useFormItem = (expose) => {
11881
11923
  getPosition
11882
11924
  });
11883
11925
  return {
11884
- isNest,
11926
+ isNested,
11885
11927
  isStyleless,
11886
- isNestLast,
11928
+ isNestedLast,
11887
11929
  validateMessage,
11888
11930
  classes,
11889
11931
  labelStyle,
@@ -11910,7 +11952,7 @@ const FormItem = /* @__PURE__ */ vue.defineComponent({
11910
11952
  const it = useFormItem(expose);
11911
11953
  const {
11912
11954
  isStyleless,
11913
- isNest,
11955
+ isNested,
11914
11956
  classes,
11915
11957
  labelStyle,
11916
11958
  contentStyle,
@@ -11921,39 +11963,35 @@ const FormItem = /* @__PURE__ */ vue.defineComponent({
11921
11963
  showError,
11922
11964
  validateMessage
11923
11965
  } = it;
11924
- const {
11925
- label,
11926
- labelFor
11927
- } = props;
11928
11966
  const errorColorClass = 'vc-form-item__error';
11929
11967
  return () => {
11930
11968
  if (isStyleless.value) return [slots.default?.(), slots.error?.({
11931
11969
  show: showError.value,
11932
- nest: isNest.value,
11970
+ nested: isNested.value,
11933
11971
  message: validateMessage.value,
11934
11972
  class: [errorColorClass, ...errorClass.value],
11935
11973
  style: errorStyle.value
11936
11974
  })];
11937
11975
  return vue.createVNode("div", {
11938
11976
  "class": ['vc-form-item', classes.value]
11939
- }, [(label || slots.label) && vue.createVNode("div", {
11977
+ }, [(props.label || slots.label) && vue.createVNode("div", {
11940
11978
  "style": labelStyle.value,
11941
11979
  "class": ['vc-form-item__label', ...labelClass.value],
11942
- "for": labelFor
11943
- }, [vue.createVNode("label", null, [label || slots.label?.()])]), vue.createVNode("div", {
11980
+ "for": props.labelFor
11981
+ }, [vue.createVNode("label", null, [props.label || slots.label?.()])]), vue.createVNode("div", {
11944
11982
  "class": "vc-form-item__wrapper"
11945
11983
  }, [vue.createVNode("div", {
11946
11984
  "class": ['vc-form-item__content', ...contentClass.value],
11947
11985
  "style": contentStyle.value
11948
11986
  }, [slots.default?.(), slots.error ? slots.error({
11949
11987
  show: showError.value,
11950
- nest: isNest.value,
11988
+ nest: isNested.value,
11951
11989
  message: validateMessage.value,
11952
11990
  class: [errorColorClass, ...errorClass.value],
11953
11991
  style: errorStyle.value
11954
11992
  }) : vue.createVNode(TransitionFade, null, {
11955
11993
  default: () => [vue.withDirectives(vue.createVNode("div", {
11956
- "class": ['vc-form-item__tip', isNest.value ? 'is-nest' : '', errorColorClass, ...errorClass.value],
11994
+ "class": ['vc-form-item__tip', isNested.value ? 'is-nested' : '', errorColorClass, ...errorClass.value],
11957
11995
  "style": [errorStyle.value]
11958
11996
  }, [validateMessage.value]), [[vue.vShow, showError.value]])]
11959
11997
  })])])]);
@@ -12024,41 +12062,36 @@ const MFormItem = /* @__PURE__ */ vue.defineComponent({
12024
12062
  labelClass,
12025
12063
  contentClass,
12026
12064
  errorClass,
12027
- isNest,
12065
+ isNested,
12028
12066
  showError,
12029
12067
  validateMessage
12030
12068
  } = it;
12031
- const {
12032
- label,
12033
- labelFor,
12034
- showMessage
12035
- } = props;
12036
12069
  const errorColorClass = 'vcm-form-item__error';
12037
12070
  return () => {
12038
12071
  if (isStyleless.value) return [slots.default?.(), slots.error?.({
12039
12072
  show: showError.value,
12040
- nest: isNest.value,
12073
+ nested: isNested.value,
12041
12074
  message: validateMessage.value,
12042
12075
  class: [errorColorClass, ...errorClass.value],
12043
12076
  style: errorStyle.value
12044
12077
  })];
12045
12078
  return vue.createVNode("div", {
12046
12079
  "style": {
12047
- paddingLeft: `${isNest.value ? 0 : props.indent}px`
12080
+ paddingLeft: `${isNested.value ? 0 : props.indent}px`
12048
12081
  },
12049
12082
  "class": [classes.value, 'vcm-form-item']
12050
12083
  }, [vue.createVNode("div", {
12051
12084
  "class": "vcm-form-item__wrapper"
12052
12085
  }, [(props.label || slots.label) && vue.createVNode("label", {
12053
- "for": labelFor,
12086
+ "for": props.labelFor,
12054
12087
  "style": labelStyle.value,
12055
12088
  "class": ['vcm-form-item__label', ...labelClass.value]
12056
- }, [label || slots.label?.()]), vue.createVNode("div", {
12089
+ }, [props.label || slots.label?.()]), vue.createVNode("div", {
12057
12090
  "style": contentStyle.value,
12058
12091
  "class": ['vcm-form-item__content', ...contentClass.value]
12059
- }, [slots.default?.(), showMessage && showError.value && vue.createVNode("div", {
12092
+ }, [slots.default?.(), props.showMessage && showError.value && vue.createVNode("div", {
12060
12093
  "class": [{
12061
- 'is-nest': isNest.value
12094
+ 'is-nested': isNested.value
12062
12095
  }, errorColorClass, ...errorClass.value],
12063
12096
  "style": errorStyle.value
12064
12097
  }, [slots.error ? slots.error({
@@ -14347,13 +14380,13 @@ const Select = /* @__PURE__ */ vue.defineComponent({
14347
14380
  "readonly": true,
14348
14381
  "placeholder": its.value.attrs?.placeholder || '请选择'
14349
14382
  }, {
14350
- prepend: () => {
14351
- if (slots.prepend) return slots.prepend?.();
14352
- if (!props.label) return null;
14353
- return vue.createVNode("span", {
14383
+ prepend: slots.prepend || props.label ? () => {
14384
+ slots.prepend ? slots.prepend() : vue.createVNode("div", {
14385
+ "class": "vc-select__prepend"
14386
+ }, [vue.createVNode("span", {
14354
14387
  "class": "vc-select__label"
14355
- }, [props.label]);
14356
- },
14388
+ }, [props.label])]);
14389
+ } : null,
14357
14390
  content: multiple.value && currentValue.value && currentValue.value.length > 0 ? () => {
14358
14391
  return vue.createVNode("div", {
14359
14392
  "class": [classes.value, 'vc-select__tags']
@@ -19995,10 +20028,13 @@ const props$c = {
19995
20028
  barStyle: [Object, String],
19996
20029
  contentStyle: [Object, String],
19997
20030
  barClass: [Object, String],
19998
- contentClass: [Object, String]
20031
+ contentClass: [Object, String],
20032
+ affixable: Boolean,
20033
+ affixOptions: Object
19999
20034
  };
20000
20035
 
20001
20036
  const useTabs = (options = {}) => {
20037
+ const affix = vue.inject("vc-affix", null);
20002
20038
  const instance = vue.getCurrentInstance();
20003
20039
  const { props, emit } = instance;
20004
20040
  const tabsId = vue.ref(Utils.getUid("tabs"));
@@ -20040,10 +20076,56 @@ const useTabs = (options = {}) => {
20040
20076
  [`is-${props.theme}`]: !!props.theme
20041
20077
  };
20042
20078
  });
20079
+ const hasAnchor = vue.computed(() => {
20080
+ return list.value.some((item) => !!item.anchor);
20081
+ });
20043
20082
  const refresh = () => {
20044
20083
  options?.refreshAfloat?.();
20045
20084
  };
20046
- const handleChange = (index) => {
20085
+ let scrollToAnchorTimer;
20086
+ const scrollToAnchor = (anchor) => {
20087
+ if (!anchor) return;
20088
+ const el = document.querySelector(anchor);
20089
+ if (!el) return;
20090
+ const scroller = getScroller(instance.vnode.el);
20091
+ $.scrollIntoView(scroller, {
20092
+ duration: 250,
20093
+ from: scroller.scrollTop,
20094
+ to: scroller.scrollTop + el.getBoundingClientRect().top - scroller.getBoundingClientRect().top - (!affix || affix.props.placement !== "bottom" ? instance.vnode.el.offsetHeight : 0) - (affix && affix.props.placement !== "bottom" ? affix.props.offset : 0)
20095
+ });
20096
+ scrollToAnchorTimer && clearTimeout(scrollToAnchorTimer);
20097
+ scrollToAnchorTimer = setTimeout(() => scrollToAnchorTimer = null, 300);
20098
+ };
20099
+ const handleAffixScroll = () => {
20100
+ if (!hasAnchor.value || scrollToAnchorTimer) return;
20101
+ const scroller = getScroller(instance.vnode.el);
20102
+ const scrollTop = scroller?.scrollTop;
20103
+ if (typeof scrollTop !== "number") return;
20104
+ for (let i = 0; i < list.value.length; i++) {
20105
+ const nav = list.value[i];
20106
+ const anchor = nav.anchor;
20107
+ if (!anchor) continue;
20108
+ const el = document.querySelector(anchor);
20109
+ if (!el) continue;
20110
+ const elTop = el.getBoundingClientRect().top - scroller.getBoundingClientRect().top + scroller.scrollTop;
20111
+ const nextNav = list.value[i + 1];
20112
+ let nextElTop;
20113
+ if (nextNav && nextNav.anchor) {
20114
+ const nextEl = document.querySelector(nextNav.anchor);
20115
+ if (nextEl) {
20116
+ nextElTop = nextEl.getBoundingClientRect().top - scroller.getBoundingClientRect().top + scroller.scrollTop;
20117
+ }
20118
+ }
20119
+ const allowDistance = 2;
20120
+ if (scrollTop >= elTop - allowDistance && (typeof nextElTop === "undefined" || scrollTop < nextElTop - allowDistance)) {
20121
+ if (getTabIndex(currentValue.value) !== i) {
20122
+ handleChange(i, false);
20123
+ }
20124
+ break;
20125
+ }
20126
+ }
20127
+ };
20128
+ const handleChange = (index, scrollTo = true) => {
20047
20129
  if (timer.value) return;
20048
20130
  timer.value = setTimeout(() => timer.value = null, 300);
20049
20131
  const nav = list.value[index];
@@ -20052,7 +20134,7 @@ const useTabs = (options = {}) => {
20052
20134
  emit("update:modelValue", currentValue.value);
20053
20135
  emit("change", currentValue.value);
20054
20136
  emit("click", currentValue.value);
20055
- nav.anchor && document.querySelector(nav.anchor)?.scrollIntoView?.({ behavior: "smooth" });
20137
+ scrollTo && scrollToAnchor(nav.anchor);
20056
20138
  };
20057
20139
  const handleResize = () => {
20058
20140
  if (instance.isUnmounted) return;
@@ -20062,10 +20144,13 @@ const useTabs = (options = {}) => {
20062
20144
  vue.onMounted(() => {
20063
20145
  helperResize.Resize.on(options.wrapper.value, handleResize);
20064
20146
  options.scrollToActive && vue.nextTick(options.scrollToActive);
20147
+ affix?.onScroll?.(handleAffixScroll);
20065
20148
  });
20066
20149
  vue.onBeforeUnmount(() => {
20067
20150
  helperResize.Resize.off(options.wrapper.value, handleResize);
20068
20151
  timer.value && clearTimeout(timer.value);
20152
+ affix?.offScroll?.(handleAffixScroll);
20153
+ scrollToAnchorTimer && clearTimeout(scrollToAnchorTimer);
20069
20154
  });
20070
20155
  const add = (item, setValue) => {
20071
20156
  if (!item) return;