css画饼图

 

<template slot-scope="scope">

          <div class="pie" :style="{'--p': scope.row.rate}" style="--p:10;--b:10px;--c:#FFAB79;">

            <!--

              --p:这个变量应该包含百分比值作为一个数字(不带%符号)。它应该与内容相同。

              --b:这个变量将定义边框的粗细。

              --c:这个变量将定义主要颜色。

            -->

            <!-- 60% -->

          </div>

          <!-- <el-progress

            type="circle"

            :percentage="scope.row.rate"

            :width="40"

            :show-text="false"

          ></el-progress> -->

        </template>

<style lang="scss" scoped>

  .pie {

   --w:50px;

   width: var(--w);

   aspect-ratio: 1; // aspect-ratio: 1用来确保元素保持方形

   position: relative;

   display: inline-grid;

   place-content: center;

   margin: 5px;

   font-size: 12px;

   font-weight: bold;

   font-family: sans-serif;

 }

 .pie:before {

   content: "";

   position: absolute;

   border-radius: 50%;

   inset: 0;

   background: conic-gradient(var(--c) calc(var(--p)*1%),rgba(28, 157, 255, 1) 0);

  //  -webkit-mask:radial-gradient(farthest-side,#0000 calc(99% - var(--b)),#000 calc(100% - var(--b)));

  //          mask:radial-gradient(farthest-side,#0000 calc(99% - var(--b)),#000 calc(100% - var(--b)));

 }

</style>

 参考文章:手把手教你使用CSS制作动态饼图(附代码)(点晴免费OA系统(国内永久免费OA协同办公管理软件)最好的官网下载)

相关推荐

最近更新

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

    2023-12-14 13:22:03       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2023-12-14 13:22:03       100 阅读
  3. 在Django里面运行非项目文件

    2023-12-14 13:22:03       82 阅读
  4. Python语言-面向对象

    2023-12-14 13:22:03       91 阅读

热门阅读

  1. 面试经典150题(15-19)

    2023-12-14 13:22:03       56 阅读
  2. k8s 环境中ipvs VS iptables

    2023-12-14 13:22:03       43 阅读
  3. 【自主探索】frontier_exploration 源码解析

    2023-12-14 13:22:03       62 阅读
  4. Golang 链表的创建和读取 小记

    2023-12-14 13:22:03       57 阅读
  5. 【Android】DeepLink

    2023-12-14 13:22:03       56 阅读
  6. 【工具类】Excel 多 Sheet 导入工具类

    2023-12-14 13:22:03       60 阅读
  7. multiprocessing --- 基于进程的并行

    2023-12-14 13:22:03       54 阅读