details.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <view class="contents">
  3. <view class="time">
  4. <text>{{ item.createTime }}</text>
  5. <text class="views" v-if="item.views">{{ item.views }} 人看过</text>
  6. </view>
  7. <view class="title">
  8. <text v-if="item.title">【{{ item.title }}】</text>
  9. </view>
  10. <view><u-parse :html="item.contents"></u-parse></view>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. data() {
  16. return {
  17. item: {}
  18. };
  19. },
  20. onLoad(e) {
  21. this.$http.request({
  22. url: this.$http.urls.news_detail + e.id,
  23. success: res => {
  24. this.item = res.data.data;
  25. }
  26. });
  27. },
  28. methods: {},
  29. onNavigationBarButtonTap() {
  30. uni.shareWithSystem({
  31. type: 'text',
  32. summary: this.item.title,
  33. href: 'https://www.baidu.com/',
  34. success() {
  35. console.log('分享成功');
  36. },
  37. fail() {
  38. console.log('分享失败');
  39. }
  40. });
  41. }
  42. };
  43. </script>
  44. <style lang="scss">
  45. page {
  46. background-color: white !important;
  47. }
  48. .contents {
  49. padding: 20px;
  50. .time {
  51. color: #818184;
  52. padding-bottom: 12px;
  53. font-size: 14px;
  54. .views {
  55. padding-left: 20px;
  56. float: right;
  57. }
  58. }
  59. .title {
  60. padding-top: 8px;
  61. font-size: 23px;
  62. font-weight: 400;
  63. margin-bottom: 20px;
  64. }
  65. }
  66. </style>