首页 > 其他分享 >罐液位变化组件

罐液位变化组件

时间:2024-03-12 14:58:00浏览次数:22  
标签:罐液 index 100% height width 组件 position 变化 absolute

接上篇

 

<template>
  <div class="jarBox">
    <!-- 罐子整体+盖 -->
    <div class="bar">
      <!-- 罐顶 -->
      <div class="barBefore"></div>
    </div>
    <!-- 里面液体整体 -->
    <div
      class="barEntity"
      :style="{
        height: number + '%',
        background:
          'linear-gradient(' + barEntityColor[0] + ',' + barEntityColor[1],
      }"
    >
      <!-- 液体顶 -->
      <div class="barEntityBefore"></div>
      <!-- 液体底 -->
      <div
        class="barEntityAfter"
        :style="{
          background:
            'linear-gradient(to bottom left,' +
            barEntityAfterColor[0] +
            ' 10%,' +
            barEntityAfterColor[1],
        }"
      ></div>
    </div>
  </div>
</template>
<script>
export default {
  name: "jarHomeBox",
  components: {},
  props: {
    number: {
      type: Number,
      default: 0,
    },
    // 液体颜色
    barEntityColor: {
      type: Array,
      default: () => {
        return ["rgba(218, 34, 255, 0.3)", "#9733EE"];
      },
    },
    // 液体底或罐底颜色
    barEntityAfterColor: {
      type: Array,
      default: () => {
        return ["rgba(218, 34, 255, 0.5)", "#9733EE"];
      },
    },
  },
  mounted() {},
};
</script>

<style scoped lang="scss">
.jarBox {
  position: absolute;
  top: 24%;
  left: 10%;
  height: 68%;
  width: 80%;
  z-index: 9;

  // 罐子整体
  .bar {
    position: relative;
    height: 100%;
    width: 100%;
    background: transparent;
    // 罐顶
    .barBefore {
      position: absolute;
      top: -10px;
      content: "";
      width: 100%;
      height: 18px;
      border-radius: 50%;
      z-index: 3;
    }
  }
  // 液体
  .barEntity {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 0;
    z-index: 2;
    transition: height 1s ease; //简简单单过度效果就可以解决,搞了那么一圈用动画,真费劲
    // 液体顶
    .barEntityBefore {
      position: absolute;
      top: -16px;
      // content: "";
      width: 100%;
      height: 30px;
      border-radius: 50%;
      //background: url("~@/assets/images/screen/barWater.png") no-repeat;
      //background-size: 100% 100%;
        background: #08b9ff;
      z-index: 2;
    }
    // 罐底
    .barEntityAfter {
      position: absolute;
      bottom: -11px;
      content: "";
      width: 100%;
      height: 24px;
      border-radius: 50%;
      z-index: 1;
    }
  }
}
</style>

 

标签:罐液,index,100%,height,width,组件,position,变化,absolute
From: https://www.cnblogs.com/ruyijiang/p/18068300

相关文章

  • 双轮播加切换动画效果组件
    效果如图,结合了一些动画效果和图片背景,组件开发思路:左侧按钮设置定时器为大轮播,下侧按钮设置定时器为小轮播当轮播到当组的最后一个就继续大轮播,停掉小轮播,并处理一些特殊情况和翻页情况。代码已经注释掉引入图片的路径换成背景颜色,可直接运行。 <template><divcla......
  • 在Vue 3中,当computed属性中使用到的store中的变量或ref变量发生更新时,computed属性会
    computed传入一个getter函数,返回一个默认不可手动修改的ref对象在Vue3中,当computed属性中使用到的store中的变量或ref变量发生更新时,computed属性会自动重新计算,反映出最新的值。就是任何组件内导致store的变量变化也会导致其它组件内的computed变量变化与执行在Vue3中,当......
  • C++ Qt开发:QNetworkAccessManager网络接口组件
    Qt是一个跨平台C++图形界面开发库,利用Qt可以快速开发跨平台窗体应用程序,在Qt中我们可以通过拖拽的方式将不同组件放到指定的位置,实现图形化开发极大的方便了开发效率,本章将重点介绍如何运用QNetworkAccessManager组件实现Web网页访问。QNetworkAccessManager是Qt网络模块中的关......
  • Prometheus组件构成及介绍
    Prometheus是一个开源的监控和告警工具包,其常用的组件主要包括以下几个部分:PrometheusServer功能:PrometheusServer是Prometheus的核心组件,负责定时从被监控组件(如Kubernetes、Docker、主机等)中拉取(pull)数据,并将其存储在本地的时间序列数据库中。它还提供了灵活的查询语言(Pro......
  • forms组件
    forms组件(1)介绍Forms组件是用来处理用户提交的数据,并将其转换成Python可处理的数据类型。Forms组件提供了一种简单的方式来定义表单的结构以及验证用户输入的数据。通过使用Forms组件,你可以有效地处理用户输入的数据,包括验证、转换以及显示错误信息。(2)基本使用fromdjangoi......
  • vue3 父子组件间通讯
    1、父组件向子组件传值父组件<fitSteps:stepActive="stepActive"><div>插槽信息</div>      <van-buttontype="primary"@click="FatherClick">下一步</van-button></fitSteps>conststepActive=ref......
  • 组件的定义
    定义组件: 1.函数式定义:<divid="test"></div><scripttype="text/babel">//创建函数式组件functionDemo(){return<h2>定义的简单组件</h2>}ReactDom.render(<Demo/>,document.getElementByI......
  • Vue组件库的选择与实现 - ViewDesign
    随着Web应用的不断进化和发展,前端开发的需求也在日益增加。在这样的背景下,Vue框架以及各种Vue组件库应运而生。本文将探讨如何选择一个高质量的Vue组件库,并通过使用ViewDesign库阐述如何实现高效、优雅的前端架构。前端架构的重要性前端架构的设计对于整个项目的成功至关重要。......
  • 2024新版Axure RP大数据可视化大屏模板68套及通用组件+PSD文件
    AxureRP数据可视化大屏模板及通用组件库2024新版重新制作了这套新的数据可视化大屏模板及通用组件库V2版。新版本相比于V1版内容更加丰富和全面,但依然秉承“敏捷易用”的制作理念,这套作品也同样延续着我们对细节的完美追求,整个设计制作过程我们同样投入了大量的精力。作品制作前......
  • DependencyCheck开源的软件组件漏洞检测工具
    DependencyCheck是一个开源的软件组件漏洞检测工具,用于帮助开发人员和安全团队发现项目中使用的第三方库中的已知漏洞。它扫描应用程序的依赖关系,包括第三方库、框架和其他组件,然后与漏洞数据库进行比较,以识别是否存在已公开披露的安全漏洞。1.主要特点包括:1.**自动化扫描:**De......