Browse Source

refactor: ♻️ 修改

pull/24/head
姜鑫 2 years ago
parent
commit
0e1398b5ff
  1. 6
      src/App.vue
  2. 6
      src/components/ScrollList/ScrollList.vue
  3. 2
      src/components/ScrollListItem/ScrollListItem.vue

6
src/App.vue

@ -1,7 +1,7 @@
<template> <template>
<WeatherAndTime :mall-code="mallCode" /> <WeatherAndTime :mall-code="mallCode" />
<ScrollList ref="scrollList" :customer-list="customerList" :mall-code="mallCode" /> <ScrollList ref="scrollList" :customer-list="customerList" :mall-code="mallCode" />
<img src="./assets/images/back_index_icon.svg" class="fixed bottom-3 left-3 w-28 h-12 z-100" alt="" @click="back" />
<img src="./assets/images/back_index_icon.svg" class="fixed bottom-11 left-[52px] w-28 h-12 z-100" alt="" @click="back" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, onBeforeUnmount, ref, toRefs, shallowRef } from 'vue' import { onMounted, onBeforeUnmount, ref, toRefs, shallowRef } from 'vue'
@ -39,7 +39,7 @@ onMounted(() => {
_getCustomerList() _getCustomerList()
timer = setInterval(() => { timer = setInterval(() => {
_getCustomerList() _getCustomerList()
scrollList.value.swiper?.value?.scrollTo(0, 1000, false)
scrollList.value.scroll()
}, 1000 * 60) }, 1000 * 60)
}) })
onBeforeUnmount(() => { onBeforeUnmount(() => {
@ -47,7 +47,7 @@ onBeforeUnmount(() => {
}) })
function back() { function back() {
scrollList.value.swiper?.value?.scrollTo(0, 1000, false)
scrollList.value.scroll()
} }
</script> </script>

6
src/components/ScrollList/ScrollList.vue

@ -56,8 +56,12 @@ function swiperInit(_swiper: any) {
swiper.value = _swiper swiper.value = _swiper
} }
function scroll() {
swiper.value?.slideTo(0)
}
defineExpose({ defineExpose({
swiper
scroll
}) })
</script> </script>

2
src/components/ScrollListItem/ScrollListItem.vue

@ -15,7 +15,7 @@
{{ formatDate(customer.addTime) }} {{ formatDate(customer.addTime) }}
</div> </div>
<ScrollView class="relative h-[355px]" scrollbar :list="customer.suggestionContent"> <ScrollView class="relative h-[355px]" scrollbar :list="customer.suggestionContent">
<div class="text-[#C70082] text-24 font-normal leading-normal whitespace-normal pr-[14px]">
<div class="text-[#C70082] text-24 font-normal leading-normal whitespace-normal pr-[14px] pb-10">
<div v-html="customer.suggestionContent"></div> <div v-html="customer.suggestionContent"></div>
</div> </div>
</ScrollView> </ScrollView>

Loading…
Cancel
Save