@varlet/ui 2.22.1 → 2.22.2

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.
@@ -112,16 +112,10 @@ const __sfc__ = defineComponent({
112
112
  () => length.value,
113
113
  () => __async(this, null, function* () {
114
114
  yield doubleRaf();
115
- indexAnchors.forEach(({ name: name2 }) => {
116
- if (name2.value)
117
- anchorNameList.value.push(name2.value);
118
- });
115
+ anchorNameList.value = indexAnchors.filter(({ name: name2 }) => name2.value != null).map(({ name: name2 }) => name2.value);
119
116
  })
120
117
  );
121
- onSmartMounted(() => __async(this, null, function* () {
122
- yield setScroller();
123
- addScrollerListener();
124
- }));
118
+ onSmartMounted(setupScroller);
125
119
  onBeforeUnmount(removeScrollerListener);
126
120
  onDeactivated(() => {
127
121
  isDeactivated = true;
@@ -195,16 +189,14 @@ const __sfc__ = defineComponent({
195
189
  clickedName.value = "";
196
190
  });
197
191
  }
198
- function setScroller() {
199
- return __async(this, null, function* () {
200
- yield doubleRaf();
201
- scroller = getParentScroller(barEl.value);
202
- });
203
- }
204
- function addScrollerListener() {
192
+ function setupScroller() {
193
+ scroller = getParentScroller(barEl.value);
205
194
  scroller.addEventListener("scroll", handleScroll);
206
195
  }
207
196
  function removeScrollerListener() {
197
+ if (!scroller) {
198
+ return;
199
+ }
208
200
  scroller.removeEventListener("scroll", handleScroll);
209
201
  }
210
202
  function scrollTo(index, options) {
@@ -262,7 +262,7 @@ import './tooltip/style/index.mjs'
262
262
  import './uploader/style/index.mjs'
263
263
  import './watermark/style/index.mjs'
264
264
 
265
- const version = '2.22.1'
265
+ const version = '2.22.2'
266
266
 
267
267
  function install(app) {
268
268
  ActionSheet.install && app.use(ActionSheet)
package/es/index.mjs CHANGED
@@ -174,7 +174,7 @@ export * from './tooltip/index.mjs'
174
174
  export * from './uploader/index.mjs'
175
175
  export * from './watermark/index.mjs'
176
176
 
177
- const version = '2.22.1'
177
+ const version = '2.22.2'
178
178
 
179
179
  function install(app) {
180
180
  ActionSheet.install && app.use(ActionSheet)
@@ -83,7 +83,11 @@ const __sfc__ = defineComponent({
83
83
  const offsetTop = computed(() => toPxNum(props2.offsetTop));
84
84
  let scroller;
85
85
  watch(() => props2.disabled, resize);
86
- onSmartMounted(addScrollListener);
86
+ onSmartMounted(() => __async(this, null, function* () {
87
+ yield doubleRaf();
88
+ setupScroller();
89
+ handleScroll();
90
+ }));
87
91
  onSmartUnmounted(removeScrollListener);
88
92
  onWindowResize(resize);
89
93
  useEventListener(() => window, "scroll", handleScroll);
@@ -122,15 +126,24 @@ const __sfc__ = defineComponent({
122
126
  isFixed: false
123
127
  };
124
128
  }
125
- function handleScroll() {
126
- if (!scroller) {
127
- return;
129
+ function setupScroller() {
130
+ scroller = getParentScroller(stickyEl.value);
131
+ if (scroller !== window) {
132
+ scroller.addEventListener("scroll", handleScroll);
128
133
  }
134
+ }
135
+ function handleScroll() {
129
136
  const fixedParams = computeFixedParams();
130
137
  if (fixedParams) {
131
138
  call(props2.onScroll, fixedParams.offsetTop, fixedParams.isFixed);
132
139
  }
133
140
  }
141
+ function removeScrollListener() {
142
+ if (!scroller || scroller === window) {
143
+ return;
144
+ }
145
+ scroller.removeEventListener("scroll", handleScroll);
146
+ }
134
147
  function resize() {
135
148
  return __async(this, null, function* () {
136
149
  isFixed.value = false;
@@ -138,17 +151,6 @@ const __sfc__ = defineComponent({
138
151
  computeFixedParams();
139
152
  });
140
153
  }
141
- function addScrollListener() {
142
- return __async(this, null, function* () {
143
- yield doubleRaf();
144
- scroller = getParentScroller(stickyEl.value);
145
- scroller !== window && scroller.addEventListener("scroll", handleScroll);
146
- handleScroll();
147
- });
148
- }
149
- function removeScrollListener() {
150
- scroller !== window && scroller.removeEventListener("scroll", handleScroll);
151
- }
152
154
  return {
153
155
  stickyEl,
154
156
  wrapperEl,
File without changes