最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

vue柱狀進(jìn)度條圖像的完美實(shí)現(xiàn)方案

 更新時(shí)間:2019年08月26日 09:56:15   作者:Haorooms  
本文是對bar進(jìn)度條實(shí)現(xiàn)的2種方案進(jìn)行分享,第一種是很簡單,純css的實(shí)現(xiàn),第二種是echart的實(shí)現(xiàn)。對vue柱狀進(jìn)度條圖像的實(shí)現(xiàn)方案,感興趣的朋友跟隨小編一起看看吧

前言

本文是對bar進(jìn)度條實(shí)現(xiàn)的2種方案進(jìn)行分享,第一種是很簡單,純css的實(shí)現(xiàn),第二種是echart的實(shí)現(xiàn)。

css的實(shí)現(xiàn)

css實(shí)現(xiàn)很簡單。代碼如下:

<template>
 <div class="haoroomflex">
  <div v-for="(item,index) in barData" :key="index" class="onebar">
   <div class="bar">
    <span class="progress" :style="{'height':`${item.value*100}%`}" />
   </div>
   <div class="sfont">{{ item.date }}</div>
  </div>

 </div>
</template>
<script>

export default {
 props: {
  barData: {
   type: Array,
   default() {
    return [
     { date: '', value: 0 },
     { date: '', value: 0 },
     { date: '', value: 0 }
    ]
   }
  }
 }

}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.haoroomflex{display: flex;margin:0 15px;}
.onebar{
 flex:1;
 text-align: center;
 min-width: 30px;
 max-width: 100px;
 display: inline-block;
 .sfont{
  color:#999;
  font-size:14px;
 }
 .bar{
  height: 160px;
  width:24px;
  margin:5px auto;
  -webkit-border-radius: 24px;
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  background: #e5e5e5;
  span.progress {
   position: absolute;
   bottom:0;
   height: 0;
   width: 100%;
   display: block;
   -webkit-border-radius: 24px;
   border-radius: 24px;
   -webkit-transition: height 2s ease-out;
   -o-transition: height 2s ease-out;
   transition: height 2s ease-out;
   background: #3990FF

  }
 }
}
</style>

效果如下

 

echart實(shí)現(xiàn)

<template>
 <div class="linechartWrap">
  <v-chart class="barchart" :options="options" autoresize />
 </div>
</template>

<script>
import ECharts from 'vue-echarts'
import 'echarts/lib/chart/bar'
import 'echarts/lib/component/tooltip'
import 'echarts/lib/component/title'
import 'echarts/lib/component/toolbox'

export default {
 components: {
  'v-chart': ECharts
 },
 props: {
  barData: {
   type: Object,
   default() {
    return {
     data: [11, 33, 77],
     title: ['07-01', '07-02', '07-03']
    }
   }
  }
 },
 computed: {
  options() {
   return {
    grid: {
     show: 'true',
     borderWidth: '0',
     height: '72%',
     width: '90%',
     x: '12%',
     y: '20%'
    },
    tooltip: {
     trigger: 'axis',
     axisPointer: {
      type: 'none'
     },
     formatter: '{b0}: {c0}%'
    /* formatter: function(params) {
      var result = '';
      params.forEach(function (item) {
        result += item.marker + " " + item.seriesName + " : " + item.value +"</br>";
      });
      return result;
    }*/
    },
    backgroundColor: '#fff', // 背景色
    yAxis: {
     show: false, // 是否顯示x軸
     type: 'value'
    },
    xAxis: {
     type: 'category',
     axisLabel: {
      show: true,
      textStyle: {
       color: '#666' // y軸字體顏色
      }
     },
     splitLine: { show: false }, // 橫向的線
     axisTick: { show: false }, // y軸的端點(diǎn)
     axisLine: { show: false }, // y軸的線
     data: this.barData.title
    },
    series: [
     {
      type: 'bar',
      itemStyle: {
       normal: {
        barBorderRadius: 25,
        color: '#3990FF'
       }
      },
      barWidth: 25,
      data: this.barData.data
     },
     {
      name: '外框',
      type: 'bar',
      itemStyle: {
       normal: {
        barBorderRadius: 25,
        color: '#e5e5e5' // rgba設(shè)置透明度0.14
       }
      },
      barGap: '-100%',
      z: 0,
      barWidth: 25,
      data: [100, 100, 100]
     }
    ]
   }
  }
 }

}
</script>

代碼地址

代碼已經(jīng)上傳github,地址是: https://github.com/confidence68/bar_precent_css

總結(jié)

以上所述是小編給大家介紹的vue柱狀進(jìn)度條圖像的完美實(shí)現(xiàn)方案,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
如果你覺得本文對你有幫助,歡迎轉(zhuǎn)載,煩請注明出處,謝謝!

相關(guān)文章

  • Vue組件中prop屬性使用說明實(shí)例代碼詳解

    Vue組件中prop屬性使用說明實(shí)例代碼詳解

    這篇文章主要介紹了Vue組件中prop屬性使用說明,非常不錯(cuò)具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2018-05-05
  • vue使用keep-alive如何實(shí)現(xiàn)多頁簽并支持強(qiáng)制刷新

    vue使用keep-alive如何實(shí)現(xiàn)多頁簽并支持強(qiáng)制刷新

    這篇文章主要介紹了vue使用keep-alive如何實(shí)現(xiàn)多頁簽并支持強(qiáng)制刷新,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-08-08
  • vue項(xiàng)目登錄頁面實(shí)現(xiàn)記住用戶名和密碼的示例代碼

    vue項(xiàng)目登錄頁面實(shí)現(xiàn)記住用戶名和密碼的示例代碼

    本文主要介紹了vue項(xiàng)目登錄頁面實(shí)現(xiàn)記住用戶名和密碼的示例代碼,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-07-07
  • Vue+Element?switch組件的使用示例代碼詳解

    Vue+Element?switch組件的使用示例代碼詳解

    這篇文章主要介紹了Vue+Element?switch組件的使用,本文通過示例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-06-06
  • 解決使用vue.js路由后失效的問題

    解決使用vue.js路由后失效的問題

    下面小編就為大家分享一篇解決使用vue.js路由后失效的問題,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-03-03
  • 詳解vue beforeRouteEnter 異步獲取數(shù)據(jù)給實(shí)例問題

    詳解vue beforeRouteEnter 異步獲取數(shù)據(jù)給實(shí)例問題

    這篇文章主要介紹了vue beforeRouteEnter 異步獲取數(shù)據(jù)給實(shí)例問題,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-08-08
  • 解決element-ui?el-drawer抽屜el-dialog彈框關(guān)閉優(yōu)化demo

    解決element-ui?el-drawer抽屜el-dialog彈框關(guān)閉優(yōu)化demo

    這篇文章主要為大家介紹了解決element-ui?el-drawer抽屜el-dialog彈框關(guān)閉優(yōu)化demo,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪<BR>
    2023-06-06
  • Vue 2源碼解析Parse函數(shù)定義

    Vue 2源碼解析Parse函數(shù)定義

    這篇文章主要為大家介紹了Vue 2源碼解析Parse函數(shù)定義,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-08-08
  • Vue生命周期與setup深入詳解

    Vue生命周期與setup深入詳解

    Vue的生命周期就是vue實(shí)例從創(chuàng)建到銷毀的全過程,也就是new Vue() 開始就是vue生命周期的開始。Vue 實(shí)例有?個(gè)完整的?命周期,也就是從開始創(chuàng)建、初始化數(shù)據(jù)、編譯模版、掛載Dom -> 渲染、更新 -> 渲染、卸載 等?系列過程,稱這是Vue的?命周期
    2022-09-09
  • 使用 vue.js 構(gòu)建大型單頁應(yīng)用

    使用 vue.js 構(gòu)建大型單頁應(yīng)用

    本文給大家詳細(xì)介紹了如何使用使用 vue.js腳手架工具vue-cli構(gòu)建大型單頁應(yīng)用的方法,非常的實(shí)用,有需要的小伙伴可以參考下
    2018-02-02

最新評論

太仆寺旗| 赫章县| 务川| 中方县| 鄢陵县| 天台县| 修水县| 田阳县| 楚雄市| 蒙山县| 香港 | 德清县| 固镇县| 克什克腾旗| 莒南县| 高清| 昆山市| 新野县| 新疆| 天峨县| 龙川县| 略阳县| 奎屯市| 乌海市| 朝阳县| 达尔| 宜兴市| 奉新县| 新龙县| 惠来县| 镇平县| 中阳县| 马边| 深泽县| 洛南县| 定边县| 凤冈县| 明溪县| 芒康县| 昭通市| 仁寿县|