index.vue 986 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <template>
  2. <view class="p-[30rpx] bg-white">
  3. <!-- 标题 -->
  4. <view class="text-[36rpx] font-bold text-[#333] leading-[1.5] mb-[20rpx] text-center">
  5. {{ news.title }}
  6. </view>
  7. <!-- 发布信息 -->
  8. <view class="flex justify-between mb-[30rpx] text-[#666] text-[28rpx]">
  9. <text>发布时间:{{ news.time }}</text>
  10. <text>浏览次数:{{ news.views }} 次</text>
  11. </view>
  12. <!-- 内容 -->
  13. <view class="text-[28rpx] text-[#333] leading-[1.8]">
  14. <rich-text :nodes="news.content"></rich-text>
  15. </view>
  16. <CustomTabBar :current="0" />
  17. </view>
  18. </template>
  19. <script setup lang="ts">
  20. import { ref, onMounted } from 'vue'
  21. import CustomTabBar from "@/components/CustomTabBar.vue";
  22. const news = ref({
  23. title: '',
  24. time: '',
  25. views: 0,
  26. content: ''
  27. })
  28. onMounted(() => {
  29. const pageParams = uni.getStorageSync('newsParams')
  30. if (pageParams) {
  31. news.value = pageParams
  32. uni.removeStorageSync('newsParams')
  33. }
  34. })
  35. </script>