index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <div class="Visit">
  3. <div class="ban"></div>
  4. <div class="nav_2">
  5. <ul>
  6. <li
  7. :class="{ cur: $route.meta.nameAll === item.name }"
  8. v-for="(item, index) in topLi"
  9. :key="index"
  10. @click="skip(item.path)"
  11. >
  12. <img :src="require(`@/assets/images/Visit/${item.img}`)" alt="" />
  13. <p>{{ item.name }}</p>
  14. </li>
  15. </ul>
  16. </div>
  17. <div class="pos">
  18. <span class="pos1">Your Position:</span>
  19. <Router-link to="/Layout/Home">Home></Router-link>
  20. <Router-link to="/Layout/Visit">Visit></Router-link>
  21. <span>{{$route.meta.nameAll}}></span>
  22. </div>
  23. <!-- 二级嵌套路由 -->
  24. <Router-view />
  25. </div>
  26. </template>
  27. <script>
  28. export default {
  29. name: "Visit",
  30. components: {},
  31. data() {
  32. //这里存放数据
  33. return {
  34. topLi: [
  35. { name: "Hours, Direction & Admission", img: "m-9.png", path: "/Layout/Visit/1" },
  36. { name: "Reservation", img: "m-10.png", path: "/Layout/Visit/2" },
  37. { name: "Floor Plans", img: "m-11.png", path: "/Layout/Visit/3" },
  38. { name: "Audio Guide & Tour", img: "m-12.png", path: "/Layout/Visit/4" },
  39. { name: "Accessibility", img: "m-13.png", path: "/Layout/Visit/5" },
  40. { name: "Café & Shop", img: "m-14.png", path: "/Layout/Visit/6" },
  41. { name: "Visitor Guidelines", img: "m-15.png", path: "/Layout/Visit/7" },
  42. ],
  43. };
  44. },
  45. //监听属性 类似于data概念
  46. computed: {},
  47. //监控data中的数据变化
  48. watch: {},
  49. //方法集合
  50. methods: {
  51. skip(url){
  52. this.$router.push(url).catch(() => {});
  53. }
  54. },
  55. //生命周期 - 创建完成(可以访问当前this实例)
  56. created() {},
  57. //生命周期 - 挂载完成(可以访问DOM元素)
  58. mounted() {},
  59. beforeCreate() {}, //生命周期 - 创建之前
  60. beforeMount() {}, //生命周期 - 挂载之前
  61. beforeUpdate() {}, //生命周期 - 更新之前
  62. updated() {}, //生命周期 - 更新之后
  63. beforeDestroy() {}, //生命周期 - 销毁之前
  64. destroyed() {}, //生命周期 - 销毁完成
  65. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  66. };
  67. </script>
  68. <style lang='less' scoped>
  69. .Visit {
  70. .ban {
  71. width: 100%;
  72. margin: auto;
  73. background: url("../../assets/images/Visit/m-4.jpg") no-repeat center top
  74. #000000;
  75. height: 300px;
  76. }
  77. .nav_2 {
  78. width: 100%;
  79. padding-bottom: 8px;
  80. background: url("../../assets/images/Visit/bg_3.png") left bottom repeat-x
  81. #f1f1f1;
  82. overflow: hidden;
  83. zoom: 1;
  84. & > ul {
  85. display: flex;
  86. width: 1180px;
  87. margin: 0 auto;
  88. & > li {
  89. background: #f1f1f1;
  90. cursor: pointer;
  91. width: 168px;
  92. height: 108px;
  93. text-align: center;
  94. & > img {
  95. margin-top: 25px;
  96. }
  97. & > p {
  98. margin-top: 5px;
  99. font-size: 14px;
  100. line-height: 18px;
  101. }
  102. }
  103. .cur {
  104. background: url("../../assets/images/Visit/bg_1.jpg") center top
  105. no-repeat #f1f1f1;
  106. }
  107. }
  108. }
  109. .pos{
  110. height: 28px;
  111. line-height: 28px;
  112. font-size: 12px;
  113. margin: 0 auto 10px auto;
  114. width: 1180px;
  115. .pos1{
  116. color: #c20e11;
  117. }
  118. }
  119. }
  120. </style>