@rao2126340634/yt-ui 1.2.1 → 1.2.11

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.

Potentially problematic release.


This version of @rao2126340634/yt-ui might be problematic. Click here for more details.

package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rao2126340634/yt-ui",
3
- "version": "1.2.1",
3
+ "version": "1.2.11",
4
4
  "description": "uniapp vue3 component library for zjyt wechat miniprogram",
5
5
  "main": "src/components",
6
6
  "publishConfig": {
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { computed, CSSProperties, onUnmounted, ref, shallowRef, watch } from 'vue'
2
+ import { computed, onUnmounted, ref, shallowRef, watch } from 'vue'
3
3
  import { ThemeColor } from '../../types/theme-types'
4
4
  import { useInterval } from '../../hooks/useInterval'
5
5
 
@@ -256,10 +256,12 @@
256
256
  watch(
257
257
  () => [props.list, props.loop] as const,
258
258
  ([list, loop]) => {
259
+ const oldLength = visibleList.value.length
259
260
  if (!list.length) {
260
261
  visibleList.value = []
261
262
  } else if (loop && list.length > 1) {
262
263
  visibleList.value = [list[list.length - 1], ...list, list[0]]
264
+ if (oldLength === 0) curIndex.value = 1 // 异步数据传入时重置index
263
265
  } else {
264
266
  visibleList.value = list // 直接引用
265
267
  }
@@ -443,8 +445,7 @@
443
445
  if (props.loop) targetIndex++
444
446
  const safeIndex = Math.min(visibleList.value.length - 1, Math.max(0, targetIndex))
445
447
  handleLoopJump(safeIndex, false)
446
- },
447
- { immediate: true }
448
+ }
448
449
  )
449
450
 
450
451
  onUnmounted(() => {