index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <div class="Collections">
  3. <div class="ban">
  4. <img src="@/assets/img/bannerC.png" alt="" />
  5. <h3>Collections</h3>
  6. </div>
  7. <div class="main">
  8. <div class="row" v-for="(item, index) in data" :key="index">
  9. <img :src="require(`@/assets/img/Collections/${item.img}`)" alt="" />
  10. <div @click="skip(item.path)">{{ item.name }}</div>
  11. </div>
  12. </div>
  13. </div>
  14. </template>
  15. <script>
  16. export default {
  17. name: "Collections",
  18. components: {},
  19. data() {
  20. //这里存放数据
  21. return {
  22. data: [
  23. {
  24. name: "Bronzes",
  25. path: "/Layout/Collections/Bronzes",
  26. img: "Bronzes.png",
  27. },
  28. {
  29. name: "Ceramics",
  30. path: "/Layout/Collections/Ceramics",
  31. img: "Ceramics.png",
  32. },
  33. {
  34. name: "Buddhist Statues",
  35. path: "/Layout/Collections/Buddhist",
  36. img: "Buddhist.png",
  37. },
  38. {
  39. name: "Jadewares",
  40. path: "/Layout/Collections/Jadewares",
  41. img: "Jadewares.png",
  42. },
  43. {
  44. name: "Calligraphies",
  45. path: "/Layout/Collections/Calligraphies",
  46. img: "Calligraphies.png",
  47. },
  48. {
  49. name: "Paintings",
  50. path: "/Layout/Collections/Paintings",
  51. img: "Paintings.png",
  52. },
  53. {
  54. name: "Gold & Silverwares",
  55. path: "/Layout/Collections/Gold",
  56. img: "Gold.png",
  57. },
  58. {
  59. name: "Coins & Banknotes",
  60. path: "/Layout/Collections/Coins",
  61. img: "Coins.png",
  62. },
  63. {
  64. name: "Brocades & Embroideries",
  65. path: "/Layout/Collections/Brocades",
  66. img: "Brocades.png",
  67. },
  68. {
  69. name: "Cultural Supplies",
  70. path: "/Layout/Collections/Cultural",
  71. img: "Cultural.png",
  72. },
  73. {
  74. name: "Miscellaneous",
  75. path: "/Layout/Collections/Miscellaneous",
  76. img: "Miscellaneous.png",
  77. },
  78. ],
  79. };
  80. },
  81. //监听属性 类似于data概念
  82. computed: {},
  83. //监控data中的数据变化
  84. watch: {},
  85. //方法集合
  86. methods: {
  87. skip(path) {
  88. this.$router.push(path).catch(() => {});
  89. },
  90. },
  91. //生命周期 - 创建完成(可以访问当前this实例)
  92. created() {},
  93. //生命周期 - 挂载完成(可以访问DOM元素)
  94. mounted() {},
  95. beforeCreate() {}, //生命周期 - 创建之前
  96. beforeMount() {}, //生命周期 - 挂载之前
  97. beforeUpdate() {}, //生命周期 - 更新之前
  98. updated() {}, //生命周期 - 更新之后
  99. beforeDestroy() {}, //生命周期 - 销毁之前
  100. destroyed() {}, //生命周期 - 销毁完成
  101. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  102. };
  103. </script>
  104. <style lang='less' scoped>
  105. .Collections {
  106. width: 100%;
  107. background-color: #f7f6f3;
  108. .ban {
  109. position: relative;
  110. width: 100%;
  111. & > img {
  112. width: 100%;
  113. }
  114. & > h3 {
  115. position: absolute;
  116. font-size: 24px;
  117. color: #fff;
  118. left: 30px;
  119. bottom: 30px;
  120. border-bottom: 1px solid #fff;
  121. }
  122. }
  123. .main {
  124. padding: 20px;
  125. .row {
  126. position: relative;
  127. width: 100%;
  128. margin-bottom: 10px;
  129. & > img {
  130. width: 100%;
  131. border-radius: 5px;
  132. }
  133. & > div {
  134. font-weight: 700;
  135. color: #fff;
  136. font-size: 22px;
  137. position: absolute;
  138. top: 0;
  139. left: 0;
  140. width: 100%;
  141. height: 100%;
  142. display: flex;
  143. justify-content: center;
  144. align-items: center;
  145. }
  146. }
  147. }
  148. }
  149. </style>