<template>
  <view class="p-[30rpx] bg-white">

    <!-- 标题 -->
    <view class="text-[36rpx] font-bold text-[#333] leading-[1.5] mb-[20rpx] text-center">
      {{ news.title }}
    </view>

    <!-- 发布信息 -->
    <view class="flex justify-between mb-[30rpx] text-[#666] text-[28rpx]">
      <text>发布时间：{{ news.time }}</text>
      <text>浏览次数：{{ news.views }} 次</text>
    </view>

    <!-- 内容 -->
    <view class="text-[28rpx] text-[#333] leading-[1.8]">
      <rich-text :nodes="news.content"></rich-text>
    </view>
    <CustomTabBar :current="0" />
  </view>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'
import CustomTabBar from "@/components/CustomTabBar.vue";

const news = ref({
  title: '',
  time: '',
  views: 0,
  content: ''
})

onMounted(() => {
  const pageParams = uni.getStorageSync('newsParams')
  if (pageParams) {
    news.value = pageParams
    uni.removeStorageSync('newsParams')
  }
})
</script>
