<template>
  <view class="message_center">
    <cc-scroll-loading :meta="useModel?.metaData?.value" @load="method?.loadMore">
      <view
        class="message_center_items"
        v-for="(i, index) in useModel?.listData?.value"
        :key="`news_${index}`"
        @click="method?.toDetaile(i)"
      >
        <view class="title"> {{ i?.title || '' }} </view>
        <view class="time"> {{ showDay(i?.publish_at) }} </view>
        <view class="contents_des"> <rich-text :nodes="i?.content"></rich-text> </view>
        <view class="footer"> 查看详情 <uni-icons type="right" size="15"></uni-icons></view>
      </view>
    </cc-scroll-loading>
  </view>
</template>
<script setup lang="ts">
import useModel from './model'
import method from './method'
import { onLoad, onUnload } from '@dcloudio/uni-app'
import { showDay } from '@/common/libraries/day'
onLoad(() => {
  method.getList()
})

onUnload(() => {
  useModel.listData.value = []
})
</script>

<style lang="scss">
@import './style.scss';
</style>
