articleDetails.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <view style="background-color: #fff;">
  3. <u-navbar title="文章详情"></u-navbar>
  4. <view class="main">
  5. <view class="new-title">
  6. {{newsDetail.title}}
  7. </view>
  8. <view class="time">
  9. <view class="time-left">
  10. {{newsDetail.createTime}}
  11. </view>
  12. <view class="time-tight">
  13. <text class="iconfont">&#xe612;</text><text class="num">{{newsDetail.readNum}}</text>
  14. </view>
  15. </view>
  16. <view class="news-content" v-html="newsDetail.content"></view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import * as newsApi from '@/apis/news.js'
  22. export default {
  23. data() {
  24. return {
  25. id: '',
  26. newsDetail: '',
  27. }
  28. },
  29. onLoad(op) {
  30. this.id =op.id;
  31. this.getNewsInfoDetail();
  32. },
  33. methods: {
  34. getNewsInfoDetail() {
  35. uni.showLoading({
  36. title: "加载中",
  37. mask: true,
  38. })
  39. newsApi.newsInfoDetail(this.id).then((res) => {
  40. uni.hideLoading()
  41. this.newsDetail = res.data;
  42. }).catch(error => {
  43. uni.showToast({
  44. title: error,
  45. icon: "none"
  46. })
  47. })
  48. }
  49. }
  50. }
  51. </script>
  52. <style lang="scss" scoped>
  53. .main{
  54. margin: 0px 16px ;
  55. padding-bottom: 34px;
  56. .new-title{
  57. color: #101010;
  58. font-size: 18px;
  59. height: 48px;
  60. margin: 16px 0 35px;
  61. }
  62. .time{
  63. display: flex;
  64. justify-content: space-between;
  65. color: #888888;
  66. .num{
  67. margin-left: 4px;
  68. }
  69. }
  70. .news-content{
  71. margin-top: 13px;
  72. font-size: 14px;
  73. line-height: 28px;
  74. color: #101010;
  75. }
  76. }
  77. </style>