NewsList.vue 1.4 KB

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