hotGame.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <template>
  2. <ul class="list-game">
  3. <li class="game-item" v-for="(item,index) in hotGame" :key="index">
  4. <a :href="item.game_url" target="_blank">
  5. <div class="game-cover">
  6. <img v-if="item.game_icon" class="user-avatar" :src="`${item.game_icon}?imageview/0/w/180`" alt>
  7. <div
  8. v-else
  9. class="user-avatar"
  10. :class="`avatar_bg${bgColorNum(item.group_id)}`"
  11. :data-name="item.game_name && item.game_name.slice(0,2).toUpperCase()"
  12. ></div>
  13. </div>
  14. <h3 class="game-title">{{item.game_name}}</h3>
  15. </a>
  16. </li>
  17. </ul>
  18. </template>
  19. <script>
  20. import { mapState } from 'vuex'
  21. import { getAvatarBgColor } from '@/util/util'
  22. export default {
  23. name: 'hotGame',
  24. props: {
  25. },
  26. computed: {
  27. ...mapState(['hotGame'])
  28. },
  29. methods: {
  30. bgColorNum (str) {
  31. return getAvatarBgColor(str, this.userId)
  32. }
  33. },
  34. mounted () {
  35. }
  36. }
  37. </script>
  38. <style lang="scss" scoped>
  39. @import "./hotGame.scss";
  40. </style>