8313a9243a57739d06b871fc4c99ccfd655a1311.svn-base 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <div class="baseball">
  3. <div v-if="baseball.length == 0" class="no-message">暂无数据</div>
  4. <div v-for="(item, index) of baseball" :key="index">
  5. <el-table :data="item.match_data">
  6. <el-table-column type="expand" style="border: none">
  7. <template slot-scope="props">
  8. <div v-if="props.row.play_data.length > 2">
  9. <div style="padding: 8px 8px;margin: 0 auto">
  10. <div style="font-weight:bold;">结果:</div>
  11. <div style="margin-left: 40px;line-height: 28px;" v-for="(res, index) of props.row.play_data" :key="index">
  12. <div v-if="index < props.row.play_data.length -2">{{res.play_name}}:{{res.play_result}}</div>
  13. </div>
  14. </div>
  15. </div>
  16. <div v-else style="text-align:center">暂无数据</div>
  17. </template>
  18. </el-table-column>
  19. <el-table-column :label="item.league_name" width="400" align="center" style="border-left:none">
  20. <template slot-scope="scope">
  21. {{scope.row.match_time}}
  22. <span style="width: 400px;font-weight:bold">
  23. {{scope.row.home_team}}
  24. <span style="color: #ff9200">VS</span>
  25. {{scope.row.guest_team}}
  26. </span>
  27. </template>
  28. </el-table-column>
  29. <el-table-column label="第1局至第五局" align="center" prop="score_result"></el-table-column>
  30. <el-table-column label="全场" align="center" prop="score_result"></el-table-column>
  31. </el-table>
  32. </div>
  33. </div>
  34. </template>
  35. <script>
  36. export default {
  37. name: 'baseball',
  38. props: {
  39. baseballData: {
  40. type: Array,
  41. default: ()=>[]
  42. },
  43. loading: {
  44. type: Boolean,
  45. default: false
  46. }
  47. },
  48. data() {
  49. return {
  50. baseball: [],
  51. bsLoading: false,
  52. show: true,
  53. test: '1'
  54. }
  55. },
  56. watch: {
  57. baseballData: {
  58. handler(val) {
  59. if(val) {
  60. this.baseball = JSON.parse(JSON.stringify(val))
  61. }
  62. },
  63. deep: true
  64. },
  65. loading(val) {
  66. this.bsLoading = val
  67. }
  68. },
  69. methods: {
  70. // 默认展开
  71. initShow() {
  72. for(let item of this.baseball) {
  73. item.show = !item.show;
  74. }
  75. },
  76. setShow(val, index) {
  77. val.show = !val.show
  78. },
  79. }
  80. }
  81. </script>
  82. <style>
  83. .baseball .el-table {
  84. border-top: none;
  85. }
  86. .baseball .el-table th {
  87. padding: 8px 0;
  88. background-color: #373737;
  89. color: #ffffff;
  90. font-size: 14px;
  91. font-weight: 700;
  92. }
  93. .baseball .sec-table .el-table th {
  94. padding: 4px 0;
  95. background-color: #e3e3e3;
  96. color: #ffffff;
  97. font-size: 14px;
  98. font-weight: 500;
  99. }
  100. .baseball .el-table td {
  101. padding: 6px 0;
  102. }
  103. .baseball .el-table--border th {
  104. border: none;
  105. }
  106. </style>
  107. <style scoped>
  108. .no-message {
  109. text-align: center;
  110. margin-top: 50px;
  111. padding-right: 100px;
  112. font-size: 16px;
  113. font-weight: 700;
  114. }
  115. </style>