
卡片式分页界面
Element-UI分页组件
发布日期:2021-05-14 15:19:28
浏览次数:23
分类:原创文章
本文共 5725 字,大约阅读时间需要 19 分钟。
卡 片 式 分 页 界 面 卡片式分页界面 卡片式分页界面
Element-UI卡片
<template><div class=""> <div class="list-group"> <el-row :gutter="20"> <el-col :span="6" class="col-group"> <router-link to="/test"> <el-card class="card-group"> <img src="https://img1.baidu.com/it/u=2424515499,933640072&fm=26&fmt=auto&gp=0.jpg" class="thumbnail" alt="" > <div class="title">喵喵</div> </el-card> </router-link> </el-col> </el-row> </div></div></template>
template
<div class="list-group"> <el-row :gutter="20"> <el-col :span="6" class="col-group" v-for="dataset in datasets" :key="dataset.id"> <router-link :to="dataset.linkto"> <el-card class="card-group"> <img :src="dataset.logo" class="thumbnail" alt="" > <div class="title">{ { dataset.name}}</div> </el-card> </router-link> </el-col> </el-row> </div>
js
<script type="text/ecmascript-6">import { Card,Row,Col} from "element-ui"export default { name: "DataSet", data() { return { datasets:[] } }, components:{ [Card.name]:Card, [Row.name]:Row, [Col.name]:Col, }, mounted(){ this.$http.get("/api/datasetslist").then(res =>{ console.log(res.data.dataset) this.datasets = res.data.dataset; }).catch(err =>{ console.log(err) }) }}</script>
CSS
.list-group{ width: 800px; .col-group{ margin-top: 20px; cursor: pointer; .card-group{ height: 180px; width: 100%; .thumbnail{ width: 100%; } .title{ padding-top: 10px; } } .add-card{ font: bolder 100px '微软雅黑'; display: flex; text-align: center; justify-content: center; color: #BBBEC7; &:hover{ box-shadow: 0px 0 1px rgba(0, 0, 0, 0.4); } } } .pagination{ text-align: right; padding-top: 20px; }}
示例
<template><div class=""> <div class="list-group"> <el-row :gutter="20"> <el-col :span="6" class="col-group"> <router-link to="/test"> <el-card class="card-group"> <img src="https://img1.baidu.com/it/u=2424515499,933640072&fm=26&fmt=auto&gp=0.jpg" class="thumbnail" alt="" > <div class="title">喵喵</div> </el-card> </router-link> </el-col> </el-row> </div></div></template><script type="text/ecmascript-6">import { Card,Row,Col} from "element-ui"export default { name: "Cv", data() { return { } }, components:{ [Card.name]:Card, [Row.name]:Row, [Col.name]:Col, },}</script><style scoped lang='scss'>.list-group{ width: 800px; .col-group{ margin-top: 20px; cursor: pointer; .card-group{ height: 100%; width: 100%; .thumbnail{ width: 100%; height: 100%; } .title{ padding-top: 10px; } } .add-card{ font: bolder 100px '微软雅黑'; display: flex; text-align: center; justify-content: center; color: #BBBEC7; &:hover{ box-shadow: 0px 0 1px rgba(0, 0, 0, 0.4); } } } .pagination{ text-align: right; padding-top: 20px; }}</style>
Element-UI分页组件el-pagination
<el-pagination layout="prev, pager, next" :total="total_page" :page-size="12" :current-page="current_page" class="pagination" @current-change="onCurrentChange"> </el-pagination>
<template><div class=""> <div class="list-group"> <el-row :gutter="20"> <el-col :span="6" class="col-group" v-for="dataset in cv_datasets" :key="dataset.id"> <router-link :to="dataset.linkto"> <el-card class="card-group"> <img :src="dataset.logo" class="thumbnail" alt="" > <div class="title">{ { dataset.name}}</div> </el-card> </router-link> </el-col> </el-row> <el-pagination layout="prev, pager, next" :total="total_page" :page-size="12" :current-page="current_page" class="pagination" @current-change="onCurrentChange"> </el-pagination> </div></div></template><script type="text/ecmascript-6">import { Card,Row,Col,Pagination} from "element-ui"export default { name: "DataSet", data() { return { cv_datasets:[], total_page:0, current_page:1, } }, components:{ [Card.name]:Card, [Row.name]:Row, [Col.name]:Col, [Pagination.name]:Pagination, }, mounted(){ this.$http.get('/api/cv_datasetslist').then(res =>{ console.log(res.data.cv_dataset) this.cv_datasets = res.data.cv_dataset; this.total_page = 20 }).catch(err =>{ console.log(err) }) }, methods:{ onCurrentChange(page){ console.log(page) } }}</script><style scoped lang='scss'>.list-group{ width: 800px; .col-group{ margin-top: 20px; cursor: pointer; .card-group{ height: 180px; width: 100%; .thumbnail{ width: 100%; } .title{ padding-top: 10px; } } .add-card{ font: bolder 100px '微软雅黑'; display: flex; text-align: center; justify-content: center; color: #BBBEC7; &:hover{ box-shadow: 0px 0 1px rgba(0, 0, 0, 0.4); } } } .pagination{ text-align: right; padding-top: 20px; }}</style>
卡片跳转问题
<el-col :span="6" class="col-group" v-for="dataset in cv_datasets" :key="dataset.id"> <router-link :to="cv/detail?id='+dataset.id"> <el-card class="card-group"> <img :src="dataset.logo" class="thumbnail" alt="" > <div class="title">{ { dataset.name}}</div> </el-card> </router-link></el-col>
发表评论
最新留言
感谢大佬
[***.8.128.20]2025年04月08日 11时26分20秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
2020版nodejs12.18.3安装配置教程
2019-03-11
iview组件库中,Form组件里的Input,无法正确绑定on-enter事件
2019-03-11
记录-基于springboot+vue.js实现的超大文件分片极速上传及流式下载
2019-03-11
JavaScript高级程序设计第四版学习记录-第九章代理与反射
2019-03-11
怎么解决Windows 10文件/文件夹正在使用无法删除
2019-03-11
matlab函数:fix 向0取整
2019-03-11
ORCAD创建元件库时,格点对不起怎么办
2019-03-11
Allegro中如何消除器件本身Pin间距报错
2019-03-11
AD中拖动器件,无法移动在一起如何解决
2019-03-11
linux--练习001-基础类型
2019-03-11
Flask--简介
2021-05-14
Flask模板--过滤器与测试器
2021-05-14
16 python基础-恺撒密码
2021-05-14
06.1 python基础--结构控制
2021-05-14
Frame--Api框架
2021-05-14
Frame--WEB框架
2021-05-14
idea 在Debug 模式中运行语句中函数的方法
2021-05-14
springboot2.1.1开启druid数据库连接池并开启监控
2021-05-14