项目作者: Moonphy

项目描述 :
vue下的canvas百分比圆环图
高级语言: Vue
项目地址: git://github.com/Moonphy/vue-percent-annular.git
创建时间: 2019-06-11T03:07:55Z
项目社区:https://github.com/Moonphy/vue-percent-annular

开源协议:

下载


vue-percent-annular

vue下面的一个单值百分百圆环图

vue项目中如何使用

  1. # install
  2. npm i vue-percent-annular
  3. # vue项目的main.js中引入及注册
  4. import percent from 'vue-percent-annular'
  5. Vue.use(percent)
  6. # 在页面中使用
  7. <template>
  8. <div class="percentWrap">
  9. <percent
  10. :theme="theme"
  11. :percent="percent"
  12. :text-name="textName"
  13. ></percent>
  14. </div>
  15. </template>
  16. export default {
  17. data () {
  18. return {
  19. percent: 60,
  20. textName: '市场占有率',
  21. theme: 'blueLight'
  22. }
  23. }
  24. }
  25. .percentWrap{
  26. height: 500px;
  27. background-color: #42b983;
  28. }

options

可以通过props改变几种配置

1、theme

  • 百分比的颜色(主题),目前定制了三种颜色,分别是’orange’,’blueLight’, ‘blueDark’,后期有时间会加入自定义颜色,直接传色值

2、percent

  • 百分百值

3、text-name

  • 显示的二级说明文字

另外

控制圆环图的大小是通过设置percent这个组件的父级dom元素就行,如:

  1. .percentWrap{
  2. height: 500px;
  3. background-color: #42b983;
  4. }