提供一个vue前端页面示例,样式使用elementui,页面包括大轮播图、公告、侧边滚动定位导航、图片展示、小走马灯、图文卡片、返回顶部、页面底部

时间: 2023-09-18 21:08:31 浏览: 40
以下是一个基于ElementUI的Vue前端页面示例,包括大轮播图、公告、侧边滚动定位导航、图片展示、小走马灯、图文卡片、返回顶部、页面底部。 ```html <template> <div class="page"> <!-- 大轮播图 --> <el-carousel :autoplay="true" :interval="4000" arrow="never"> <el-carousel-item v-for="(item, index) in bannerList" :key="index"> <img :src="item.imageUrl" alt=""> </el-carousel-item> </el-carousel> <!-- 公告 --> <div class="notice"> <i class="el-icon-information"></i> <el-marquee :speed="20">{{ noticeText }}</el-marquee> </div> <!-- 侧边滚动定位导航 --> <div class="aside"> <el-menu :default-active="activeMenu" class="menu" :collapse-transition="false" mode="vertical" @select="handleMenuSelect" > <el-menu-item v-for="(item, index) in menuList" :key="index" :index="item.id">{{ item.name }}</el-menu-item> </el-menu> </div> <!-- 图片展示 --> <div class="gallery"> <el-image v-for="(item, index) in galleryList" :key="index" :src="item.imageUrl" :preview-src-list="item.previewList" fit="cover" class="gallery-item" ></el-image> </div> <!-- 小走马灯 --> <div class="carousel-small"> <el-carousel :autoplay="true" :interval="3000" arrow="never" type="card"> <el-carousel-item v-for="(item, index) in smallCarouselList" :key="index"> <img :src="item.imageUrl" alt=""> </el-carousel-item> </el-carousel> </div> <!-- 图文卡片 --> <div class="card-list"> <el-card v-for="(item, index) in cardList" :key="index" :header="item.title" :body-style="{ padding: '0px' }" > <img :src="item.imageUrl" class="image" slot="cover" /> <div style="padding: 14px;"> <span>{{ item.description }}</span> <div class="bottom clearfix"> <div class="price">{{ item.price }}</div> <div class="button-wrapper"> <el-button type="primary" size="small">购买</el-button> </div> </div> </div> </el-card> </div> <!-- 返回顶部 --> <div class="back-to-top" @click="scrollToTop"> <i class="el-icon-arrow-up"></i> </div> <!-- 页面底部 --> <div class="footer"> <span>版权所有 © 2021 xxx公司</span> </div> </div> </template> <script> export default { data() { return { bannerList: [], // 大轮播图列表 noticeText: '', // 公告文字 menuList: [], // 侧边滚动导航菜单列表 activeMenu: '0', // 当前选中的导航菜单项 galleryList: [], // 图片展示列表 smallCarouselList: [], // 小走马灯列表 cardList: [], // 图文卡片列表 }; }, mounted() { // 初始化数据 this.initData(); // 监听滚动事件,判断是否显示返回顶部按钮 window.addEventListener('scroll', this.handleScroll); }, methods: { // 初始化数据 initData() { // TODO: 获取数据 }, // 处理侧边导航菜单选中事件 handleMenuSelect(index) { this.activeMenu = index; // TODO: 根据选中的菜单项跳转到相应的位置 }, // 处理滚动事件 handleScroll() { const scrollTop = document.documentElement.scrollTop || document.body.scrollTop; if (scrollTop > 200) { this.showBackToTop = true; } else { this.showBackToTop = false; } }, // 滚动到页面顶部 scrollToTop() { window.scrollTo({ top: 0, behavior: 'smooth' }); }, }, }; </script> <style lang="scss" scoped> .page { .notice { margin: 20px 0; display: flex; align-items: center; i { margin-right: 10px; font-size: 16px; color: #f56c6c; } .el-marquee { font-size: 14px; color: #333; white-space: nowrap; } } .aside { position: fixed; top: 100px; left: 0; width: 180px; height: 100%; .menu { background: #f5f5f5; border-right: 1px solid #e0e0e0; } } .gallery { display: flex; flex-wrap: wrap; margin: 20px 0; .gallery-item { width: calc(25% - 10px); margin-right: 10px; margin-bottom: 10px; } } .carousel-small { margin-bottom: 20px; .el-carousel__item { height: 150px; display: flex; justify-content: center; align-items: center; img { width: 100%; height: 100%; object-fit: cover; } } } .card-list { display: flex; flex-wrap: wrap; margin-bottom: 20px; .el-card { width: calc(33.3% - 10px); margin-right: 10px; margin-bottom: 10px; .image { height: 150px; object-fit: cover; } .bottom { margin-top: 10px; .price { float: left; font-size: 16px; color: #f60; } .button-wrapper { float: right; } } } } .back-to-top { position: fixed; bottom: 50px; right: 50px; width: 40px; height: 40px; line-height: 40px; text-align: center; background-color: #f60; color: #fff; border-radius: 50%; cursor: pointer; transition: opacity 0.3s; i { font-size: 20px; } &:hover { opacity: 0.8; } } .footer { height: 50px; display: flex; justify-content: center; align-items: center; background-color: #f5f5f5; span { font-size: 14px; color: #666; } } } </style> ```

相关推荐

最新推荐

recommend-type

vue实现的上传图片到数据库并显示到页面功能示例

主要介绍了vue实现的上传图片到数据库并显示到页面功能,结合实例形式分析了基于vue.js的数据库操作及页面图片显示相关操作技巧,需要的朋友可以参考下
recommend-type

基于VUE选择上传图片并页面显示(图片可删除)

主要为大家详细介绍了基于VUE选择上传图片并页面显示,图片可以删除的效果,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
recommend-type

Vue下滚动到页面底部无限加载数据的示例代码

本篇文章主要介绍了Vue下滚动到页面底部无限加载数据的示例代码,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
recommend-type

vue+elementUi图片上传组件使用详解

主要为大家详细介绍了vue+elementUi图片上传组件的使用方法,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
recommend-type

解决vue多个路由共用一个页面的问题

下面小编就为大家分享一篇解决vue多个路由共用一个页面的问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
recommend-type

zigbee-cluster-library-specification

最新的zigbee-cluster-library-specification说明文档。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

实现实时数据湖架构:Kafka与Hive集成

![实现实时数据湖架构:Kafka与Hive集成](https://img-blog.csdnimg.cn/img_convert/10eb2e6972b3b6086286fc64c0b3ee41.jpeg) # 1. 实时数据湖架构概述** 实时数据湖是一种现代数据管理架构,它允许企业以低延迟的方式收集、存储和处理大量数据。与传统数据仓库不同,实时数据湖不依赖于预先定义的模式,而是采用灵活的架构,可以处理各种数据类型和格式。这种架构为企业提供了以下优势: - **实时洞察:**实时数据湖允许企业访问最新的数据,从而做出更明智的决策。 - **数据民主化:**实时数据湖使各种利益相关者都可
recommend-type

SPDK_NVMF_DISCOVERY_NQN是什么 有什么作用

SPDK_NVMF_DISCOVERY_NQN 是 SPDK (Storage Performance Development Kit) 中用于查询 NVMf (Non-Volatile Memory express over Fabrics) 存储设备名称的协议。NVMf 是一种基于网络的存储协议,可用于连接远程非易失性内存存储器。 SPDK_NVMF_DISCOVERY_NQN 的作用是让存储应用程序能够通过 SPDK 查询 NVMf 存储设备的名称,以便能够访问这些存储设备。通过查询 NVMf 存储设备名称,存储应用程序可以获取必要的信息,例如存储设备的IP地址、端口号、名称等,以便能
recommend-type

JSBSim Reference Manual

JSBSim参考手册,其中包含JSBSim简介,JSBSim配置文件xml的编写语法,编程手册以及一些应用实例等。其中有部分内容还没有写完,估计有生之年很难看到完整版了,但是内容还是很有参考价值的。