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 ...
随机推荐
- Proxyless Mesh 在 Dubbo 中的实践
背景 随着 Dubbo 3.1 的 release,Dubbo 在云原生的路上又迈出了重要的一步.在这个版本中添加了 Proxyless Mesh 的新特性,Dubbo Proxyless Mesh ...
- [seaborn] seaborn学习笔记9-绘图实例(1) Drawing example(1)
文章目录 9 绘图实例(1) Drawing example(1) 1. Anscombe's quartet(lmplot) 2. Color palette choices(barplot) 3. ...
- 软件安装——tortoiseGit安装和配置
Tortoisegit安装指南 TortoiseGit是一个开放的Git版本控制系统的源客户端,它是Git和Windows资源管理器的整合,提供了Git的图形化操作界面 一.软件安装 1.进入tort ...
- 02-Tcl输出、赋值与替换
2 Tcl输出.赋值与替换 2.1 puts Tcl的输出命令是puts,将字符串标准输出channelled.语法中两个问号之间的参数为可选参数. # 例1 puts hello # 输出 hell ...
- 通过Docker启动Solace,并在Spring Boot通过JMS整合Solace
1 简介 Solace是一个强大的实时性的事件驱动消息队列.本文将介绍如何在Spring中使用,虽然代码使用的是Spring Boot,但并没有使用相关starter,跟Spring的整合一样,可通用 ...
- 加速 Document AI (文档智能) 发展
在企业的数字工作流中充满了各种文档,包括信件.发票.表格.报告.收据等,我们无法自动提取它们的知识.如今随着文本.视觉和多模态人工智能的进步,我们有可能解锁这些知识,这篇文章向你展示了你的团队该如何使 ...
- angular8表格文件上传并渲染到页面(上传文本与表格,表格有两种写法--之二)
import { Component, OnInit , ViewChild, OnDestroy, AfterViewInit } from '@angular/core'; import { ST ...
- SSM进行Query
在查询之前,需要输入数据库字段的名称,s_id需要获取
- dapr本地托管的服务调用体验与Java SDK的Spring Boot整合
1 简介 之前在文章<dapr入门与本地托管模式尝试>中介绍了dapr和本地托管,本文我们来介绍如果在代码中使用dapr的服务调用功能,并把它整合到Spring Boot中. Dapr服务 ...
- ADC-CH32FV2x_V3x 框图功能详解
主要特性(CH32FV2x_V3x) 系列:l 12 位分辨率l 支持 16 个外部通道和 2 个内部信号源采样l 多通道的多种采样转换方式:单次.连续.扫描.触发.间断等l 数据对齐模式:左对齐.右 ...