NewsList.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <li v-if="newsData" @click.prevent="checkInfo(newsData)">
  3. <div class="newsInfor-img-box" :style="{backgroundImage: `url(${newsData.pic || newsInforImg})`}"></div>
  4. <div class="newsInfor-list-content">
  5. <h5>{{newsData.title}}</h5>
  6. <div><span class="mta-hidden-sm">{{newsData.startTime}}</span></div>
  7. <div class="mta-hidden-xs"><i></i><span>{{newsData.startTime}}</span><i type="visits"></i><span>{{newsData.visits}}</span>
  8. </div>
  9. <p>{{newsData.intro}}</p>
  10. <a class="mta-hidden-xs" :href="`${baseUrl}/news/${newsData.code}`" >
  11. <span>了解更多</span>
  12. </a>
  13. </div>
  14. </li>
  15. </template>
  16. <script>
  17. import { mapGetters } from 'vuex';
  18. export default {
  19. name: 'NewList',
  20. props: {
  21. newsData: {
  22. type: Object,
  23. default: () => {
  24. },
  25. },
  26. },
  27. data() {
  28. return {
  29. newsInforImg: require(`~/static/images/client/newsInfor/newsInfor-list-img.png`),
  30. };
  31. },
  32. computed: {
  33. baseUrl() {
  34. return this.getBaseUrl;
  35. },
  36. ...mapGetters(['getBaseUrl']),
  37. },
  38. methods: {
  39. checkInfo(data) {
  40. // console.log(window.localtion.href);
  41. // console.log(self.localtion.href);
  42. // console.log(document.URL);
  43. const opt = {
  44. id: data.code,
  45. };
  46. this.$router.push({ name: 'news-id', params: opt });
  47. this.$emit('know-more', data);
  48. },
  49. },
  50. };
  51. </script>
  52. <style scoped>
  53. </style>