@varlet/ui 2.22.1-alpha.1706370837642 → 2.22.1

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.
@@ -42,7 +42,6 @@ const __sfc__ = defineComponent({
42
42
  inheritAttrs: false,
43
43
  props,
44
44
  setup(props2) {
45
- const ownTop = ref(0);
46
45
  const disabled = ref(false);
47
46
  const name2 = computed(() => props2.index);
48
47
  const anchorEl = ref(null);
@@ -51,16 +50,15 @@ const __sfc__ = defineComponent({
51
50
  const indexAnchorProvider = {
52
51
  index,
53
52
  name: name2,
54
- ownTop,
55
- setOwnTop,
56
- setDisabled
53
+ setDisabled,
54
+ getOffsetTop
57
55
  };
58
56
  bindIndexBar(indexAnchorProvider);
59
- function setOwnTop() {
57
+ function getOffsetTop() {
60
58
  if (!anchorEl.value) {
61
- return;
59
+ return 0;
62
60
  }
63
- ownTop.value = anchorEl.value.$el ? anchorEl.value.$el.offsetTop : anchorEl.value.offsetTop;
61
+ return anchorEl.value.$el ? anchorEl.value.$el.offsetTop : anchorEl.value.offsetTop;
64
62
  }
65
63
  function setDisabled(value) {
66
64
  disabled.value = value;
@@ -112,10 +112,9 @@ const __sfc__ = defineComponent({
112
112
  () => length.value,
113
113
  () => __async(this, null, function* () {
114
114
  yield doubleRaf();
115
- indexAnchors.forEach(({ name: name2, setOwnTop }) => {
115
+ indexAnchors.forEach(({ name: name2 }) => {
116
116
  if (name2.value)
117
117
  anchorNameList.value.push(name2.value);
118
- setOwnTop();
119
118
  });
120
119
  })
121
120
  );
@@ -158,9 +157,9 @@ const __sfc__ = defineComponent({
158
157
  const scrollHeight = scroller === window ? document.body.scrollHeight : scroller.scrollHeight;
159
158
  const offsetTop = getOffsetTop();
160
159
  indexAnchors.forEach((anchor, index) => {
161
- const anchorTop = anchor.ownTop.value;
160
+ const anchorTop = anchor.getOffsetTop();
162
161
  const top = scrollTop - anchorTop + stickyOffsetTop.value - offsetTop;
163
- const distance = index === indexAnchors.length - 1 ? scrollHeight : indexAnchors[index + 1].ownTop.value - anchor.ownTop.value;
162
+ const distance = index === indexAnchors.length - 1 ? scrollHeight : indexAnchors[index + 1].getOffsetTop() - anchor.getOffsetTop();
164
163
  anchor.setDisabled(true);
165
164
  if (top >= 0 && top < distance && clickedName.value === "") {
166
165
  anchor.setDisabled(false);
@@ -181,7 +180,8 @@ const __sfc__ = defineComponent({
181
180
  return;
182
181
  }
183
182
  const offsetTop = getOffsetTop();
184
- const top = indexAnchor.ownTop.value - stickyOffsetTop.value + offsetTop;
183
+ const indexAnchorTop = indexAnchor.getOffsetTop();
184
+ const top = indexAnchorTop - stickyOffsetTop.value + offsetTop;
185
185
  const left = getScrollLeft(scroller);
186
186
  clickedName.value = anchorName;
187
187
  emitEvent(anchorName, 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-alpha.1706370837642'
265
+ const version = '2.22.1'
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-alpha.1706370837642'
177
+ const version = '2.22.1'
178
178
 
179
179
  function install(app) {
180
180
  ActionSheet.install && app.use(ActionSheet)
@@ -67,6 +67,9 @@ function usePopover(options) {
67
67
  let enterPopover = false;
68
68
  let enterHost = false;
69
69
  const computeHostSize = () => {
70
+ if (!host.value) {
71
+ return;
72
+ }
70
73
  const { width, height } = getStyle(host.value);
71
74
  hostSize.value = {
72
75
  width: toPxNum(width),