Vue使用el-statistic和el-card显示大屏中的统计数据


一、页面内容:
<el-row :gutter="20">
  <el-col :span="6">
    <el-card class="box-card">
      <div>
      <el-statistic
        group-separator=","
        :precision="2"
        :value="value2"
        :title="title"
      ></el-statistic>
      </div>
    </el-card>
  </el-col>


  <el-col :span="6">
    <el-card class="box-card">
    <div>
      <el-statistic title="男女比">
        <template slot="formatter">
          456/2
        </template>
      </el-statistic>
    </div>
    </el-card>
  </el-col>

  <el-col :span="6">
    <el-card class="box-card">
    <div>
      <el-statistic
        group-separator=","
        :precision="2"
        decimal-separator="."
        :value="value1"
        :title="title"
      >
        <template slot="prefix">
          <i class="el-icon-s-flag" style="color: red"></i>
        </template>
        <template slot="suffix">
          <i class="el-icon-s-flag" style="color: blue"></i>
        </template>
      </el-statistic>
    </div>
    </el-card>
  </el-col>
  <el-col :span="6">
    <el-card class="box-card">
    <div>
      <el-statistic :value="like ? 521 : 520" title="Feedback">
        <template slot="suffix">
          <span @click="like = !like" class="like">
            <i
              class="el-icon-star-on"
              style="color:red"
              v-show="!!like"
            ></i>
            <i class="el-icon-star-off" v-show="!like"></i>
          </span>
        </template>
      </el-statistic>
    </div>
    </el-card>
  </el-col>
</el-row>


二、数据
data() {
  return {
    like: true,
    value1: 4154.564,
    value2: 1314,
    title: "增长人数",
  };
},
三、样式
<style scoped lang="scss">
.like {
  cursor: pointer;
  font-size: 25px;
  display: inline-block;
}
.box-card {
  width: 90%;
  height: 100px;
}
</style>

相关推荐

  1. Vue3el-table表格数据显示

    2024-03-28 15:30:03       46 阅读
  2. vue 导出el-table选择数据使用笔记

    2024-03-28 15:30:03       52 阅读
  3. element-UIel-scrollbar使用

    2024-03-28 15:30:03       58 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-28 15:30:03       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-28 15:30:03       100 阅读
  3. 在Django里面运行非项目文件

    2024-03-28 15:30:03       82 阅读
  4. Python语言-面向对象

    2024-03-28 15:30:03       91 阅读

热门阅读

  1. Bean对象拷贝工具封装

    2024-03-28 15:30:03       40 阅读
  2. 若依分离版 —引入echart连接Springboot后端

    2024-03-28 15:30:03       42 阅读
  3. openGauss的索引组织表

    2024-03-28 15:30:03       40 阅读
  4. pytorch常用的模块函数汇总(2)

    2024-03-28 15:30:03       37 阅读