zoukankan      html  css  js  c++  java
  • Card 卡片

    将信息聚合在卡片容器中展示。

    基础用法

    包含标题,内容和操作。

    Card 组件包括headerbody部分,header部分需要有显式具名 slot 分发,同时也是可选的。

     1 <el-card class="box-card">
     2   <div slot="header" class="clearfix">
     3     <span>卡片名称</span>
     4     <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>
     5   </div>
     6   <div v-for="o in 4" :key="o" class="text item">
     7     {{'列表内容 ' + o }}
     8   </div>
     9 </el-card>
    10 
    11 <style>
    12   .text {
    13     font-size: 14px;
    14   }
    15 
    16   .item {
    17     margin-bottom: 18px;
    18   }
    19 
    20   .clearfix:before,
    21   .clearfix:after {
    22     display: table;
    23     content: "";
    24   }
    25   .clearfix:after {
    26     clear: both
    27   }
    28 
    29   .box-card {
    30     width: 480px;
    31   }
    32 </style>
    View Code

    简单卡片

    卡片可以只有内容区域。

     1 <el-card class="box-card">
     2   <div v-for="o in 4" :key="o" class="text item">
     3     {{'列表内容 ' + o }}
     4   </div>
     5 </el-card>
     6 
     7 <style>
     8   .text {
     9     font-size: 14px;
    10   }
    11 
    12   .item {
    13     padding: 18px 0;
    14   }
    15 
    16   .box-card {
    17     width: 480px;
    18   }
    19 </style>
    View Code

    带图片

    可配置定义更丰富的内容展示。

    配置body-style属性来自定义body部分的style,我们还使用了布局组件。

     1 <el-row>
     2   <el-col :span="8" v-for="(o, index) in 2" :key="o" :offset="index > 0 ? 2 : 0">
     3     <el-card :body-style="{ padding: '0px' }">
     4       <img src="~examples/assets/images/hamburger.png" class="image">
     5       <div style="padding: 14px;">
     6         <span>好吃的汉堡</span>
     7         <div class="bottom clearfix">
     8           <time class="time">{{ currentDate }}</time>
     9           <el-button type="text" class="button">操作按钮</el-button>
    10         </div>
    11       </div>
    12     </el-card>
    13   </el-col>
    14 </el-row>
    15 
    16 <style>
    17   .time {
    18     font-size: 13px;
    19     color: #999;
    20   }
    21   
    22   .bottom {
    23     margin-top: 13px;
    24     line-height: 12px;
    25   }
    26 
    27   .button {
    28     padding: 0;
    29     float: right;
    30   }
    31 
    32   .image {
    33     width: 100%;
    34     display: block;
    35   }
    36 
    37   .clearfix:before,
    38   .clearfix:after {
    39       display: table;
    40       content: "";
    41   }
    42   
    43   .clearfix:after {
    44       clear: both
    45   }
    46 </style>
    47 
    48 <script>
    49 export default {
    50   data() {
    51     return {
    52       currentDate: new Date()
    53     };
    54   }
    55 }
    56 </script>
    View Code

    Attributes

    参数说明类型可选值默认值
    header 设置 header,也可以通过 slot#header 传入 DOM string
    body-style 设置 body 的样式 object { padding: '20px' }
  • 相关阅读:
    STM32L476的RTC使用问题记录
    python数据分析之:时间序列二
    python+NLTK 自然语言学习处理七:N-gram标注
    python数据分析之:时间序列一
    如何在ubuntun中安装intellij idea 2018并破解
    python+NLTK 自然语言学习处理六:分类和标注词汇一
    python数据分析之:数据聚合与分组运算
    500 Lines or Less: A Template Engine(模板引擎)
    python+NLTK 自然语言学习处理五:词典资源
    Django之博客系统:在网站中分享内容(一)
  • 原文地址:https://www.cnblogs.com/grt322/p/8577857.html
Copyright © 2011-2022 走看看