imgCardLv1.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <div class="mta-card-lv1">
  3. <div class="mta-card-content-pc mta-hidden-xs">
  4. <img src="#">
  5. <div class="card-info"></div>
  6. </div>
  7. <div class="mta-card-content-h5 mta-hidden-sm">
  8. <img src="#">
  9. <div class="card-info"></div>
  10. </div>
  11. </div>
  12. </template>
  13. <script>
  14. export default {
  15. name: "imgCardLv1",
  16. props: {
  17. img: {
  18. type: String,
  19. required: true,
  20. },
  21. option: {
  22. type: Object,
  23. required: true,
  24. },
  25. col: {
  26. type: Number,
  27. default: 3
  28. }
  29. },
  30. computed: {
  31. title() {
  32. return this.option.title;
  33. },
  34. des() {
  35. return this.option.des;
  36. },
  37. tages() {
  38. const count = this.col;
  39. const list = this.option.list;
  40. const row = Math.ceil(list.length / count);
  41. const result = [];
  42. for (let i = 1; i <= row; i++) {
  43. const start = (i - 1) * count;
  44. const end = (i * count)
  45. const curList = this.list.slice(start, end);
  46. if (curList.length < count) {
  47. curList.push({type: 'empty'});
  48. }
  49. result.push(curList)
  50. }
  51. }
  52. }
  53. }
  54. </script>
  55. <style scoped>
  56. </style>