Parcourir la source

feat(news): 新增新闻详情页面- 创建新闻详情页模板结构
- 添加标题、发布时间和浏览次数展示
- 集成富文本内容显示组件
- 实现从本地存储获取新闻数据
- 添加自定义底部导航组件
- 设置页面样式和布局

nahida il y a 6 mois
Parent
commit
8c10e2641f
1 fichiers modifiés avec 41 ajouts et 0 suppressions
  1. 41 0
      src/pages/index/news-detail/index.vue

+ 41 - 0
src/pages/index/news-detail/index.vue

@@ -0,0 +1,41 @@
+<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>