_alias.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <div>
  3. <Article :news="newsItem" />
  4. </div>
  5. </template>
  6. <script>
  7. import { mapGetters } from "vuex";
  8. export default {
  9. data() {
  10. return {
  11. adsList: [],
  12. count: 0
  13. }
  14. },
  15. computed: {
  16. ...mapGetters({
  17. newsItem: "modules/news/newsItem",
  18. }),
  19. status() {
  20. if (!this.ads) {
  21. return false;
  22. } else {
  23. return true;
  24. }
  25. },
  26. },
  27. mounted() {
  28. console.log(this.newsItem)
  29. },
  30. async fetch({ store, route }) {
  31. await store.dispatch("modules/news/setNewsItem", {
  32. category: 'video',
  33. alias: route.params.alias
  34. });
  35. },
  36. head() {
  37. return {
  38. title: this.newsItem.title,
  39. meta: [
  40. {
  41. name: "description",
  42. content: this.newsItem.description,
  43. },
  44. {
  45. name: "keys",
  46. content:
  47. this.newsItem.meta.key
  48. },
  49. {
  50. hid: 'twitter:title',
  51. name: 'twitter:title',
  52. content: this.newsItem.title
  53. },
  54. {
  55. hid: 'twitter:description',
  56. name: 'twitter:description',
  57. content: this.newsItem.description
  58. },
  59. {
  60. hid: 'twitter:image',
  61. name: 'twitter:image',
  62. content: this.newsItem.image.url
  63. },
  64. {
  65. hid: 'twitter:image:alt',
  66. name: 'twitter:image:alt',
  67. content: this.newsItem.title
  68. },
  69. {
  70. hid: 'og:title',
  71. property: 'og:title',
  72. content: this.newsItem.title
  73. },
  74. {
  75. hid: 'og:description',
  76. property: 'og:description',
  77. content: this.newsItem.description
  78. },
  79. {
  80. hid: 'og:image',
  81. property: 'og:image',
  82. content: this.newsItem.image.url
  83. },
  84. {
  85. hid: 'og:image:secure_url',
  86. property: 'og:image:secure_url',
  87. content: this.newsItem.image.url
  88. },
  89. {
  90. hid: 'og:image:alt',
  91. property: 'og:image:alt',
  92. content: this.newsItem.title
  93. }
  94. ],
  95. };
  96. },
  97. };
  98. </script>
  99. <style lang="less">
  100. .detail-top__header {
  101. margin-bottom: 50px;
  102. }
  103. @media screen and (max-width: 900px) {
  104. .detail {
  105. &__wrapper {
  106. flex-direction: column-reverse;
  107. }
  108. &__side {
  109. margin-bottom: 20px;
  110. display: none;
  111. }
  112. }
  113. .detail-top {
  114. &__header {
  115. display: block;
  116. }
  117. &__footer {
  118. display: block;
  119. }
  120. &__footer-side {
  121. display: flex;
  122. margin-top: 20px;
  123. }
  124. }
  125. .detail-article-news__wrapper {
  126. display: block;
  127. }
  128. }
  129. .detail-article-news__side {
  130. display: flex;
  131. align-items: center;
  132. }
  133. </style>