数字化园区前端项目
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

ParkIntroduce.vue 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <!-- 园区介绍 -->
  2. <template>
  3. <div class="park_introduce" id="anchor-produce">
  4. <section class="top">
  5. <div class="title">小昆山数据可视化平台</div>
  6. <div class="subtitle">全面提升管理服务水平</div>
  7. </section>
  8. <ul class="middle">
  9. <li
  10. class="pointer"
  11. v-for="(item, index) in navLists"
  12. :key="item.name"
  13. @click="itemClick(index)"
  14. >
  15. <img :src="item.imgUrl" alt="" />
  16. <span>{{ item.name }}</span>
  17. </li>
  18. </ul>
  19. <section class="content row">
  20. <div :class="[lists.length < 5 ? 'row_100' : 'row_50']">
  21. <introduce :lists="lists"></introduce>
  22. <div v-if="lists.length < 5" class="top_padding">
  23. <notice :lists="lists"></notice>
  24. </div>
  25. </div>
  26. <div v-if="lists.length >= 5" class="row_50 left_padding">
  27. <notice :lists="lists"></notice>
  28. </div>
  29. </section>
  30. </div>
  31. </template>
  32. <script>
  33. //这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  34. //例如:import 《组件名称》 from '《组件路径》';
  35. import Introduce from "./Introduce.vue";
  36. import Notice from "./Notice.vue";
  37. export default {
  38. //import引入的组件需要注入到对象中才能使用
  39. components: { Introduce, Notice },
  40. props: {
  41. navLists: Array, //每个标题内容
  42. },
  43. data() {
  44. //这里存放数据
  45. return {
  46. lists: [1, 2, 3, 4, 5, 6],
  47. };
  48. },
  49. //监听属性 类似于data概念
  50. computed: {},
  51. //监控data中的数据变化
  52. watch: {},
  53. //方法集合
  54. methods: {
  55. itemClick(index) {
  56. // 获取父元素的dom元素
  57. let pageScroll = document.querySelector(".slide_nav").parentNode;
  58. // console.log(pageScroll.children[index].offsetTop + 520);
  59. // 激活当前高亮nav栏
  60. this.moveIndex = index;
  61. // 点击后滚动到相应的区域
  62. window.scrollTo({
  63. top: pageScroll.children[index].offsetTop, //举例:用户点击 第二个标签后 页面就会滚动到第二个标签的高度
  64. behavior: "instant", //丝滑滚动
  65. });
  66. },
  67. },
  68. //生命周期 - 创建完成(可以访问当前this实例)
  69. created() {},
  70. //生命周期 - 挂载完成(可以访问DOM元素)
  71. mounted() {},
  72. };
  73. </script>
  74. <style lang="scss" scoped>
  75. //@import url(); 引入公共css类
  76. .park_introduce {
  77. @include size(100%, auto);
  78. @include flex(column, space-between, center, null);
  79. background: url("~@assets/image/index/bg_produce.png") no-repeat;
  80. background-size: 100% 100%;
  81. position: relative;
  82. }
  83. .top {
  84. text-align: center;
  85. padding-top: 44px;
  86. @include border-box;
  87. .title {
  88. @include font(36px, $color-white);
  89. }
  90. .subtitle {
  91. padding-top: 10px;
  92. @include border-box;
  93. @include font(18px, $color-white);
  94. }
  95. }
  96. .middle {
  97. width: $wrapWidth;
  98. margin-top: 40px;
  99. @include flex(row, space-between, center, nowrap);
  100. li {
  101. @include font(16px, $color-white);
  102. flex: 1;
  103. @include flex(column, center, center, nowrap);
  104. img {
  105. @include size(78px, 78px);
  106. margin-bottom: 4px;
  107. }
  108. }
  109. }
  110. .content {
  111. @include size($wrapWidth, auto);
  112. background: #ffffff;
  113. padding: 50px 30px 40px;
  114. @include border-box;
  115. margin-top: 50px;
  116. }
  117. .row {
  118. @include flex(row, space-between, flex-start, nowrap);
  119. .row_50 {
  120. width: 50%;
  121. height: 100%;
  122. padding-right: 20px;
  123. @include border-box;
  124. }
  125. .row_100 {
  126. width: 100%;
  127. }
  128. .top_padding {
  129. padding-top: 50px;
  130. @include border-box;
  131. }
  132. .left_padding {
  133. padding-left: 20px;
  134. @include border-box;
  135. }
  136. }
  137. </style>