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>
<WeatherAndTime :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>
<script setup lang="ts">
import { onMounted, onBeforeUnmount, ref, toRefs, shallowRef } from 'vue'
@ -39,7 +39,7 @@ onMounted(() => {
_getCustomerList()
timer = setInterval(() => {
_getCustomerList()
scrollList.value.swiper?.value?.scrollTo(0, 1000, false)
scrollList.value.scroll()
}, 1000 * 60)
})
onBeforeUnmount(() => {
@ -47,7 +47,7 @@ onBeforeUnmount(() => {
})
function back() {
scrollList.value.swiper?.value?.scrollTo(0, 1000, false)
scrollList.value.scroll()
}
</script>

6
src/components/ScrollList/ScrollList.vue

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

2
src/components/ScrollListItem/ScrollListItem.vue

@ -15,7 +15,7 @@
{{ formatDate(customer.addTime) }}
</div>
<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>
</ScrollView>

Loading…
Cancel
Save