vue 图片分页
<div class="activities phone">
<!-- 动态 -->
<div
class="activity"
v-for="(item, index) in imgList.slice(
(currentPage - 1) * pageSize,
currentPage * pageSize
)"
:key="index"
>
<!-- 动态图片 -->
<div class="act-image-wrapper">
<div class="img-shadow"></div>
<img
:src="item.url"
class="imgCss"
alt=""
@click="gotoPage(item)"
/>
</div>
<!-- 动态元数据,包括发表日期和评论数量 -->
<div class="activity-content">
<!-- 动态标题 -->
<h2 class="act-title" @click="gotoPage(item)">
{{ item.title }}
</h2>
<!-- 动态内容摘要 -->
<article @click="gotoPage(item)">
{{ item.article }}
</article> <div class="meta" @click="gotoPage(item)">
<p class="date-published">
<i class="far fa-calendar"></i> {{ item.time }}
</p>
</div>
</div>
</div>
</div>
<!-- 分页 -->
<br />
<br />
<div class="block phone">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-size="pageSize"
layout=" prev, pager, next"
:total="totalNum"
>
</el-pagination>
</div>
data() {
return {
currentPage: 1, //默认显示第一页
pageSize: 5, //默认每页显示10条
totalNum: 15, //总页数
imgList: [
{
title: this.$t("home.t36"),
url: require("@/assets/images/greekBudget.jpg"),
article: this.$t("home.t37"),
name: "greekBudget",
time: this.$t("home.t44"),
},
{
title: this.$t("EU.t1"),
url: require("@/assets/images/EUCouncil.webp"),
article: this.$t("EU.t2"),
name: "EUCouncil",
time: "",
},
{
title: this.$t("SETE.t1"),
url: require("@/assets/images/SETE.png"),
article: this.$t("SETE.t2"),
name: "SETE",
time: this.$t("SETE.t3"),
},
{
title: this.$t("logistics.t1"),
url: require("@/assets/images/logistics.webp"),
article: this.$t("logistics.t2"),
name: "logistics",
time: this.$t("logistics.t3"),
},
{
title: this.$t("hellenistical.t1"),
url: require("@/assets/images/hellenistical.jpg"),
article: this.$t("hellenistical.t2"),
name: "hellenistical",
time: this.$t("hellenistical.t3"),
},
{
title: this.$t("economic.t1"),
url: require("@/assets/images/economic2.jpg"),
article: this.$t("economic.t3"),
name: "economic",
time: this.$t("economic.t2"),
},
{
title: this.$t("femalePresident.t1"),
url: require("@/assets/images/femalePresident1.jpg"),
article: this.$t("femalePresident.t3"),
name: "femalePresident",
time: this.$t("femalePresident.t2"),
},
{
title: this.$t("port.t1"),
url: require("@/assets/images/port1.png"),
article: this.$t("port.t4"),
name: "port",
time: this.$t("port.t3"),
},
{
title: this.$t("VisaIncrease.t1"),
url: require("@/assets/images/VisaIncrease.png"),
article: this.$t("VisaIncrease.t2"),
name: "VisaIncrease",
time: "",
},
{
title: this.$t("DebtRelief.t1"),
url: require("@/assets/images/DebtRelief.webp"),
article: this.$t("DebtRelief.t4"),
name: "DebtRelief",
time: this.$t("DebtRelief.t2"),
},
{
title: this.$t("agreement.t1"),
url: require("@/assets/images/agreement1.jpg"),
article: this.$t("agreement.t4"),
name: "agreement",
time: this.$t("agreement.t2"),
},
{
title: this.$t("Shanghai.t1"),
url: require("@/assets/images/Shanghai1.jpg"),
article: this.$t("Shanghai.t4"),
name: "Shanghai",
time: this.$t("Shanghai.t2"),
},
{
title: this.$t("cooperation.t1"),
url: require("@/assets/images/cooperation1.jpg"),
article: this.$t("cooperation.t4"),
name: "cooperation",
time: this.$t("cooperation.t2"),
},
{
title: this.$t("VisitGreece.t1"),
url: require("@/assets/images/VisitGreece1.jpg"),
article: this.$t("VisitGreece.t4"),
name: "VisitGreece",
time: this.$t("VisitGreece.t2"),
},
{
title: this.$t("SouthEurope.t1"),
url: require("@/assets/images/SouthEurope1.jpg"),
article: this.$t("SouthEurope.t4"),
name: "SouthEurope",
time: this.$t("SouthEurope.t2"),
},
],
};
},
created() {
this.totalNum = this.imgList.length; },
methods: { // 跳转页面
gotoPage(item) {
this.$router.push(item.name);
},
handleSizeChange(val) {
console.log(`每页 ${val} 条`);
this.pageSize = val; //动态改变
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`);
this.currentPage = val; //动态改变
},}
.activity {
// overflow: hidden;
transition: 0.4s;
width: 97% !important;
background: #f4f6fa;
overflow-x: hidden;
/* 动态图片容器 */
.act-image-wrapper {
height: auto;
width: 100%;
overflow: hidden;
/* 抵消activity的padding */
margin-bottom: 0;
position: relative;
.img-shadow {
z-index: 2;
position: absolute;
top: 0px;
width: 100%;
height: 100%;
min-height: 300px;
background: #030d37;
opacity: 0.7;
}
.imgCss {
width: 100%;
height: 300px;
min-height: 300px;
object-fit: cover;
}
}
.activity-content {
width: 89%;
height: 280px;
margin: 0 auto;
/* 动态标题 */
.act-title {
text-align: left;
width: 100%;
height: 68px;
font-size: 24px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #273056;
line-height: 34px;
letter-spacing: 1px;
margin-top: 22px;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
} /* 动态摘要 */
article {
width: 100%;
height: 112px;
font-size: 20px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #8086a0;
line-height: 28px;
text-align: initial;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical;
}
.meta {
width: 100%;
height: 28px;
font-size: 20px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #8086a0;
line-height: 28px;
margin-top: 20px;
text-align: initial;
}
}
}
/* 动态鼠标移上时 */
.activity:hover {
// transform: translateY(-20px) scale(1.05);
// box-shadow: 0px 0px 36px rgba(0, 0, 0, 0.1);
background: #030d37; .img-shadow {
display: none;
}
.act-title {
color: #ffffff;
}
article {
color: #b3bada;
}
.meta {
color: #b3bada;
}
}
vue 图片分页的更多相关文章
- 基于Vue封装分页组件
使用Vue做双向绑定的时候,可能经常会用到分页功能 接下来我们来封装一个分页组件 先定义样式文件 pagination.css ul, li { margin: 0px; padding: 0px;} ...
- ScrollView图片分页显示-简单
用到的控件: 1>UIScrollView:宽度和图片的宽度一样,因为分页的代码就一句 // 设置分页,这个分页的原理实际上是按照ScrollView的宽进行分页的,这里的图片的宽由于和Scro ...
- js/vue图片压缩
js版 新建compressImage.js,内容如下: // 将base64转换为blob(有需要可加上,没需要可不加) function convertBase64UrlToBlob(urlDat ...
- Vue图片懒加载插件
图片懒加载是一个很常用的功能,特别是一些电商平台,这对性能优化至关重要.今天就用vue来实现一个图片懒加载的插件. 这篇博客采用"三步走"战略--Vue.use().Vue.dir ...
- JS(vue iview)分页解决方案
JS(vue iview)分页解决方案 一.解决思路 使用分页组件 使用组件API使组件自动生成页面数量 调用组件on-change事件的返回值page 将交互获得的数组存在一个数组list中 通过p ...
- vue图片、背景图片路径问题
vue图片.背景图片路径问题 vue中引入图片经常会出现路径问题,在此记录一下: 1.组件中 <img> 引用图片 <img src="../assets/img/logo ...
- 基于vue的分页插件
相信大家用过很多jquery的分页插件,那这次就用一用基于vue的分页插件. 这里的环境用的是springboot 首先要引入pagehelper的jar文件,版本是1.2.3,配置文件也需要配置一下 ...
- Vue图片浏览组件v-viewer,支持旋转、缩放、翻转等操作
v-viewer 用于图片浏览的Vue组件,支持旋转.缩放.翻转等操作,基于viewer.js. 从0.x迁移 你需要做的唯一改动就是手动引入样式文件: 1 import 'viewerjs/dist ...
- IOS-UIScrollView实现图片分页
1.设置可以分页 _scrollView.pagingEnabled = YES; 2.添加PageControl UIPageControl *pageControl = [[UIPageContr ...
- vue 图片预览插件
https://github.com/daidaitu1314/vue2-preview //cnpm cnpm install vue2-preview -save //引入 import VueP ...
随机推荐
- python之路29 网络编程基础2之 两种架构 传输层常见协议 socket模块
软件开发架构 1.C/S架构(Client:客户端和Server:服务端) 服务器-客户机,即Client-Server(C/S)结构.C/S结构通常采取两层结构.服务器负责数据的管理,客户机负责完成 ...
- Vue3+TypeScript 项目中,配置 ESLint 和 Prettier
接上篇:从0搭建vite-vue3-ts项目框架:配置less+svg+pinia+vant+axios 文档同步项目gitee:https://gitee.com/lixin_ajax/vue3-v ...
- 鸿蒙系统应用开发之基于API6的蓝牙开发
写在前面 由题意得,我今天讲的是基于鸿蒙系统的兼容JS的类Web开发范式的软件应用开发之蓝牙开发,它是基于API6的,至于为什么是基于API6,请你花几分钟看一下我之前写的这个系列教程的第四篇&quo ...
- 百万级数据excel导出功能如何实现?
前言 最近我做过一个MySQL百万级别数据的excel导出功能,已经正常上线使用了. 这个功能挺有意思的,里面需要注意的细节还真不少,现在拿出来跟大家分享一下,希望对你会有所帮助. 原始需求:用户在U ...
- 12月13日内容总结——路由分发、名称空间、虚拟环境、视图层三板斧、JsonResponse对象、request对象获取文件、视图层FBV与CBV的源码剖析、模版层简介
目录 一.路由分发 二.名称空间 方式1:名称空间 方式2:别名不冲突即可 三.虚拟环境 pycharm创建虚拟环境 命令行的方式创建虚拟环境: 创建虚拟环境的命令 激活与关闭虚拟环境 四.视图层之必 ...
- k210 cpu、asm、rust、smpboot、ipi
介绍 k210的datasheet主要讲了与外设相关的内容,k210并不支持最新的完整的riscv指令集,而是实现了一部分.本文想要通过汇编来一点点摸索k210的寄存器,布局,mmu,缓存等结构 相关 ...
- 【爬虫+数据清洗+可视化分析】舆情分析哔哩哔哩"狂飙"的评论
目录 一.背景介绍 二.爬虫代码 2.1 展示爬取结果 2.2 爬虫代码讲解 三.可视化代码 3.1 读取数据 3.2 数据清洗 3.3 可视化 3.3.1 IP属地分析-柱形图 3.3.2 评论时间 ...
- Java ”框架 = 注解 + 反射 + 设计模式“ 之 注解详解
Java "框架 = 注解 + 反射 + 设计模式" 之 注解详解 每博一文案 刹那间我真想令时光停住,好让我回顾自己,回顾失去的年华,缅怀哪个穿一身短小的连衣裙 和瘦窄的短衫的小 ...
- ps抠图小技巧
1.背景橡皮擦工具 适合分离单一背景. 中括号键可以调整大小. 2.调整边缘抠图(也叫选择并遮住) 适合扣毛发丝. 套索工具框选出大概: 点击选择并遮住后出来一个面板: 视图选择叠加,输出设置勾上净化 ...
- PPMM
代码 #include<cstdio> using namespace std; const int N = 1000000 , INF = 2e9; int n , m , x , he ...