@@ -46,6 +46,10 @@
trailColor: {
type: String,
default: '#eaeef2'
+ },
+ dashboard: {
+ type: Boolean,
+ default: false
}
},
computed: {
@@ -55,23 +59,53 @@
height: `${this.size}px`
};
},
+ computedStrokeWidth () {
+ return this.percent === 0 && this.dashboard ? 0 : this.strokeWidth;
+ },
radius () {
return 50 - this.strokeWidth / 2;
},
pathString () {
- return `M 50,50 m 0,-${this.radius}
- a ${this.radius},${this.radius} 0 1 1 0,${2 * this.radius}
- a ${this.radius},${this.radius} 0 1 1 0,-${2 * this.radius}`;
+ if (this.dashboard) {
+ return `M 50,50 m 0,${this.radius}
+ a ${this.radius},${this.radius} 0 1 1 0,-${2 * this.radius}
+ a ${this.radius},${this.radius} 0 1 1 0,${2 * this.radius}`;
+ } else {
+ return `M 50,50 m 0,-${this.radius}
+ a ${this.radius},${this.radius} 0 1 1 0,${2 * this.radius}
+ a ${this.radius},${this.radius} 0 1 1 0,-${2 * this.radius}`;
+ }
},
len () {
return Math.PI * 2 * this.radius;
},
+ trailStyle () {
+ let style = {};
+ if (this.dashboard) {
+ style = {
+ 'stroke-dasharray': `${this.len - 75}px ${this.len}px`,
+ 'stroke-dashoffset': `-${75 / 2}px`,
+ 'transition': 'stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s'
+ }
+ }
+ return style;
+ },
pathStyle () {
- return {
- 'stroke-dasharray': `${this.len}px ${this.len}px`,
- 'stroke-dashoffset': `${((100 - this.percent) / 100 * this.len)}px`,
- 'transition': 'stroke-dashoffset 0.6s ease 0s, stroke 0.6s ease'
- };
+ let style = {};
+ if (this.dashboard) {
+ style = {
+ 'stroke-dasharray': `${(this.percent / 100) * (this.len - 75)}px ${this.len}px`,
+ 'stroke-dashoffset': `-${75 / 2}px`,
+ 'transition': 'stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s'
+ };
+ } else {
+ style = {
+ 'stroke-dasharray': `${this.len}px ${this.len}px`,
+ 'stroke-dashoffset': `${((100 - this.percent) / 100 * this.len)}px`,
+ 'transition': 'stroke-dashoffset 0.3s ease 0s, stroke 0.3s ease'
+ };
+ }
+ return style;
},
wrapClasses () {
return `${prefixCls}`;