卡片式分页界面

卡 片 式 分 页 界 面 卡片式分页界面

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>
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值