newsIndex.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <el-row class="news">
  3. <el-col :span="24" class="info">
  4. <el-col :span="24" class="top">
  5. <el-col :span="24" class="menus" :class="{ new_style: y }">
  6. <menusIndex />
  7. </el-col>
  8. <el-col :span="24" class="zero">
  9. <top-index :info="{ title: '集团新闻', enTitle: 'news' }" />
  10. </el-col>
  11. </el-col>
  12. <div class="bottom">
  13. <el-col :span="24" class="zero">
  14. <list-index />
  15. </el-col>
  16. <el-col :span="24" class="foot">
  17. <foot-index />
  18. </el-col>
  19. </div>
  20. </el-col>
  21. </el-row>
  22. </template>
  23. <script setup lang="ts">
  24. import { ref, onMounted, onUnmounted } from 'vue'
  25. defineOptions({ name: 'introduceIndex' })
  26. /* 菜单 */
  27. import menusIndex from '../../components/windows/menusIndex.vue'
  28. /* 顶部信息 */
  29. import topIndex from '../../components/windows/topIndex.vue'
  30. /* 新闻 */
  31. import listIndex from './newsParts/listIndex.vue'
  32. /* 底部信息 */
  33. import footIndex from '../../components/windows/footIndex.vue'
  34. // 获取滚动条y轴坐标
  35. const { y } = useWindowScroll()
  36. function useWindowScroll() {
  37. const y = ref(0);
  38. const handleScroll = () => {
  39. y.value = window.scrollY;
  40. };
  41. onMounted(() => {
  42. window.addEventListener('scroll', handleScroll);
  43. });
  44. onUnmounted(() => {
  45. window.removeEventListener('scroll', handleScroll);
  46. });
  47. return { y };
  48. }
  49. </script>
  50. <style scoped lang="scss">
  51. .news {
  52. .info {
  53. position: relative;
  54. background-image: url('/news5.png');
  55. background-repeat: no-repeat;
  56. background-size: 100% 480px;
  57. .top {
  58. height: 480px;
  59. .menus {
  60. position: fixed;
  61. left: 0;
  62. top: 0;
  63. width: 100%;
  64. z-index: 1000;
  65. height: 66px;
  66. -webkit-transition: all 1.5s ease;
  67. -moz-transition: all 1.5s ease;
  68. -ms-transition: all 1.5s ease;
  69. -o-transition: all 1.5s ease;
  70. transition: all 1.5s ease;
  71. }
  72. .new_style {
  73. position: fixed;
  74. left: 0;
  75. top: 0;
  76. width: 100%;
  77. z-index: 1000;
  78. background-color: #fff;
  79. -webkit-transition: all 1.5s ease;
  80. -moz-transition: all 1.5s ease;
  81. -ms-transition: all 1.5s ease;
  82. -o-transition: all 1.5s ease;
  83. transition: all 1.5s ease;
  84. }
  85. .zero {
  86. padding: 0 17%;
  87. }
  88. }
  89. .bottom {
  90. margin: 40px 0 0 0;
  91. .zero {
  92. margin: 0 0 40px 0;
  93. }
  94. }
  95. }
  96. }
  97. </style>