index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <!-- -->
  2. <template>
  3. <div class="Exhibitions">
  4. <div class="ban_wrapper" data-aria-viewport-area tabindex="0"
  5. aria-label :aria-description="`You've reached the banner area of the ${topLi[$route.params.id - 1].name} page; this area has one image; please use the tab key to navigate through the content.`"
  6. >
  7. <div class="ban" tabindex="0" aria-label="Image" :aria-description="topLi[$route.params.id - 1].name"></div>
  8. </div>
  9. <div class="nav_2" data-aria-viewport-area tabindex="0"
  10. aria-label aria-description="You've reached the secondary menu under the Exhibition section. This menu contains four options. To browse the content, please use the tab key."
  11. >
  12. <ul>
  13. <li
  14. :class="{ cur: topId === item.id }"
  15. v-for="(item, index) in topLi"
  16. :key="index"
  17. @click="skip(item.path)"
  18. @keydown.enter.passive="skip(item.path)"
  19. tabindex="0"
  20. aria-label="Link"
  21. :aria-description="item.name"
  22. >
  23. <img
  24. :src="require(`@/assets/images/Exhibitions/${item.img}`)"
  25. alt=""
  26. />
  27. <p>{{ item.name }}</p>
  28. </li>
  29. </ul>
  30. </div>
  31. <div class="pos" data-aria-viewport-area tabindex="0"
  32. aria-label aria-description="You've reached the path area; this area contains three URLs; please use the tab key to go through the content."
  33. >
  34. <span class="pos1" tabindex="0">Your Position:&nbsp;</span>
  35. <Router-link
  36. to="/Layout/Home" tabindex="0" aria-description="Home"
  37. >
  38. Home>
  39. </Router-link>
  40. <Router-link
  41. to="/Layout/Exhibitions/1" tabindex="0" aria-description="Exhibition"
  42. >
  43. Exhibitions>
  44. </Router-link>
  45. <Router-link
  46. to="" tabindex="0" :aria-description="topLi[topId - 1].name"
  47. >
  48. {{ topLi[topId - 1].name }}>
  49. </Router-link>
  50. </div>
  51. <div class="title">
  52. <img src="../../assets/images/Visit/pLeft.jpg" alt="" />
  53. <span tabindex="0">{{ topLi[topId - 1].name }}</span>
  54. <div class="xian"></div>
  55. </div>
  56. <!-- 列表页面 -->
  57. <ExhibitionsList />
  58. </div>
  59. </template>
  60. <script>
  61. import ExhibitionsList from "./component/List";
  62. export default {
  63. name: "Exhibitions",
  64. components: { ExhibitionsList },
  65. data() {
  66. //这里存放数据
  67. return {
  68. topLi: [
  69. {
  70. id: 1,
  71. name: "Current Exhibitions",
  72. img: "t_1.png",
  73. path: "/Layout/Exhibitions/1",
  74. },
  75. {
  76. id: 2,
  77. name: "Permanent Exhibitions",
  78. img: "t_2.png",
  79. path: "/Layout/Exhibitions/2",
  80. },
  81. {
  82. id: 3,
  83. name: "Past Exhibitions",
  84. img: "t_3.png",
  85. path: "/Layout/Exhibitions/3",
  86. },
  87. {
  88. id: 4,
  89. name: "Overseas Exhibitions",
  90. img: "t_4.png",
  91. path: "/Layout/Exhibitions/4",
  92. },
  93. ],
  94. topId: null,
  95. };
  96. },
  97. //监听属性 类似于data概念
  98. computed: {
  99. },
  100. //监控data中的数据变化
  101. watch: {
  102. // 监听地址栏参数变化
  103. $route: {
  104. handler: function() {
  105. // 拿到路由参数id
  106. let temp = this.$route.params.id;
  107. this.topId = Number(temp);
  108. switch (temp) {
  109. case '1':
  110. this.$eventBus.$emit('request-read', `You have reached the Current Exhibitions page of the Exhibitions section. This page includes one navigation section, six window sections, and two interactive section. To choose an section, please hit the shortcut key.`)
  111. break;
  112. case '2':
  113. this.$eventBus.$emit('request-read', `You have reached the Permanent Exhibitions page of the Exhibitions section. This page includes one navigation section, six window sections, and two interactive section. To choose an section, please hit the shortcut key.`)
  114. break;
  115. case '3':
  116. this.$eventBus.$emit('request-read', `You have reached the Past Exhibitions page of the Exhibitions section. This page includes one navigation section, six window sections, and two interactive section. To choose an section, please hit the shortcut key.`)
  117. break;
  118. case '4':
  119. this.$eventBus.$emit('request-read', `You have reached the Overseas Exhibitions page of the Exhibitions section. This page includes one navigation section, six window sections, and two interactive section. To choose an section, please hit the shortcut key.`)
  120. break;
  121. default:
  122. break;
  123. }
  124. },
  125. immediate: true
  126. },
  127. },
  128. //方法集合
  129. methods: {
  130. skip(url) {
  131. this.$router.push(url).catch(() => {});
  132. },
  133. },
  134. //生命周期 - 创建完成(可以访问当前this实例)
  135. created() {
  136. },
  137. //生命周期 - 挂载完成(可以访问DOM元素)
  138. mounted() {},
  139. beforeCreate() {}, //生命周期 - 创建之前
  140. beforeMount() {}, //生命周期 - 挂载之前
  141. beforeUpdate() {}, //生命周期 - 更新之前
  142. updated() {}, //生命周期 - 更新之后
  143. beforeDestroy() {}, //生命周期 - 销毁之前
  144. destroyed() {}, //生命周期 - 销毁完成
  145. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  146. };
  147. </script>
  148. <style lang='less' scoped>
  149. .Exhibitions {
  150. .ban {
  151. width: 100%;
  152. margin: auto;
  153. background: url("../../assets/images/Exhibitions/banner_1.jpg") no-repeat
  154. center top #000000;
  155. height: 300px;
  156. }
  157. .nav_2 {
  158. width: 100%;
  159. padding-bottom: 8px;
  160. background: url("../../assets/images/Visit/bg_3.png") left bottom repeat-x
  161. #f1f1f1;
  162. overflow: hidden;
  163. zoom: 1;
  164. & > ul {
  165. display: flex;
  166. width: 1180px;
  167. margin: 0 auto;
  168. & > li {
  169. background: #f1f1f1;
  170. cursor: pointer;
  171. width: 168px;
  172. height: 108px;
  173. text-align: center;
  174. & > img {
  175. margin-top: 25px;
  176. width: 37px;
  177. height: 37px;
  178. }
  179. & > p {
  180. margin-top: 5px;
  181. font-size: 14px;
  182. line-height: 18px;
  183. }
  184. }
  185. .cur {
  186. background: url("../../assets/images/Visit/bg_1.jpg") center top
  187. no-repeat #f1f1f1;
  188. }
  189. }
  190. }
  191. .pos {
  192. height: 28px;
  193. line-height: 28px;
  194. font-size: 12px;
  195. margin: 0 auto 10px auto;
  196. width: 1180px;
  197. .pos1 {
  198. color: #c20e11;
  199. }
  200. }
  201. .title {
  202. position: relative;
  203. display: flex;
  204. height: 65px;
  205. align-items: center;
  206. margin: 0px auto 20px;
  207. width: 1180px;
  208. font-size: 24px;
  209. font-weight: bold;
  210. text-indent: 5px;
  211. border-bottom: 1px solid black;
  212. .xian {
  213. position: absolute;
  214. bottom: -1px;
  215. left: 0;
  216. width: 80px;
  217. height: 2px;
  218. background-color: #c7000b;
  219. }
  220. }
  221. }
  222. </style>