Home.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <div
  3. class="home"
  4. >
  5. <div class="containers">
  6. <h1 class="title">
  7. {{ $gConfigInfo.title }}
  8. </h1>
  9. <ul>
  10. <li
  11. v-for="item in Object.entries($gConfigInfo.objInfo).slice(pageSize * (currentPage - 1), pageSize * currentPage)"
  12. :key="item[0]"
  13. @click="onClickItem(item)"
  14. >
  15. <img
  16. class=""
  17. :src="`${$env.BASE_URL}user-config/images/${item[0]}.jpg`"
  18. alt=""
  19. draggable="false"
  20. >
  21. <div class="title">
  22. {{ item[1] }}
  23. </div>
  24. </li>
  25. </ul>
  26. <el-pagination
  27. v-model:current-page="currentPage"
  28. v-model:page-size="pageSize"
  29. class="pagination"
  30. :page-sizes="[10, 20, 50, 100]"
  31. background
  32. layout="total, sizes, prev, pager, next, jumper"
  33. :total="Object.keys($gConfigInfo.objInfo).length"
  34. />
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. export default {
  40. name: 'HomeView',
  41. data() {
  42. return {
  43. currentPage: 1,
  44. pageSize: 10,
  45. }
  46. },
  47. computed: {
  48. ...mapState([
  49. ]),
  50. },
  51. mounted() {
  52. console.log(process.env)
  53. this.$mitt.emit('test', { msg: 'home mounted' })
  54. },
  55. unmounted() {
  56. },
  57. methods: {
  58. ...mapMutations([
  59. ]),
  60. onClickItem(item) {
  61. this.$router.push({
  62. name: 'RelicDetail',
  63. query: {
  64. m: item[0],
  65. }
  66. })
  67. }
  68. },
  69. }
  70. </script>
  71. <style lang="less" scoped>
  72. .home {
  73. width: 100%;
  74. height: 100%;
  75. .containers {
  76. padding-top: 40px;
  77. width: 100vw;
  78. max-width: 1080px;
  79. /* height: 100vh; */
  80. background-color: #285b5e;
  81. /* overflow: hidden; */
  82. height: 100%;
  83. margin: 0 auto;
  84. padding-bottom: 50px;
  85. position: relative;
  86. > .title {
  87. letter-spacing: 4px;
  88. margin: 0 auto;
  89. color: #fff;
  90. display: flex;
  91. justify-content: center;
  92. align-items: center;
  93. width: 270px;
  94. height: 50px;
  95. background: url('@/assets/images/titleBac.png') no-repeat center;
  96. background-size: 100% 100%;
  97. }
  98. > ul {
  99. width: 100%;
  100. height: calc(100% - 80px);
  101. padding-top: 30px;
  102. padding-left: 20px;
  103. display: flex;
  104. flex-wrap: wrap;
  105. align-content: start;
  106. overflow: auto;
  107. > li {
  108. display: inline-block;
  109. width: calc((100% - 20px * 4) / 3 - 1px);
  110. margin-right: 20px;
  111. margin-bottom: 20px;
  112. cursor: pointer;
  113. transition: all 0.3s;
  114. &:hover {
  115. transform: translateY(-10px);
  116. }
  117. > img {
  118. width: 100%;
  119. padding: 10px;
  120. background: url(@/assets/images/divBac.png);
  121. background-size: 100% 100%;
  122. box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.4);
  123. }
  124. > .title {
  125. color: #fff;
  126. margin-top: 10px;
  127. font-size: 16px;
  128. font-weight: 100;
  129. text-align: center;
  130. }
  131. }
  132. }
  133. .pagination {
  134. position: absolute;
  135. left: 50%;
  136. bottom: 10px;
  137. transform: translateX(-50%);
  138. }
  139. }
  140. }
  141. @media screen and (max-width: 600px) {
  142. }
  143. </style>