From 9f2506b49854bed84d1caf0b2d2b214ac16e7a0f Mon Sep 17 00:00:00 2001 From: expdsn <18111002318@163.com> Date: Mon, 11 Nov 2024 10:59:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=B0=8F=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widgets/discount/Large.tsx | 55 +++++++++++++++++++++++++++++++-- src/widgets/discount/Middle.tsx | 47 +++++++++++++++++++++++++--- 2 files changed, 95 insertions(+), 7 deletions(-) diff --git a/src/widgets/discount/Large.tsx b/src/widgets/discount/Large.tsx index b83de91..2980098 100644 --- a/src/widgets/discount/Large.tsx +++ b/src/widgets/discount/Large.tsx @@ -1,9 +1,58 @@ -import { defineComponent } from 'vue' +import { computed, defineComponent, onMounted, ref } from 'vue' +import useDiscountStore from './useDiscountStore' export default defineComponent(() => { + const store = useDiscountStore() + const idx = ref(0) + const selectItem = computed(() => { + return store.list[idx.value] + }) + onMounted(() => { + setInterval(() => { + idx.value = idx.value + 1 + if (idx.value > store.list.length - 1) { + idx.value = 0 + } + }, 5000) + }) return () => ( -