add showOriginValue configuration

This commit is contained in:
jiaming743 2020-05-06 14:13:34 +08:00
parent c98ca00179
commit 22c88c4ea5
1 changed files with 6 additions and 6 deletions

View File

@ -96,11 +96,11 @@ export default {
*/ */
animationFrame: 50, animationFrame: 50,
/** /**
* @description CRender showOriginalValue * @description showOriginValue
* @type {Boolean} * @type {Boolean}
* @default showOriginalValue = false * @default showOriginValue = false
*/ */
showOriginalValue: false showOriginValue: false
}, },
mergedConfig: null, mergedConfig: null,
@ -122,14 +122,14 @@ export default {
digitalFlopStyle, digitalFlopStyle,
digitalFlopToFixed, digitalFlopToFixed,
data, data,
showOriginalValue showOriginValue
} = mergedConfig } = mergedConfig
const value = data.map(({ value }) => value) const value = data.map(({ value }) => value)
let displayValue let displayValue
if (showOriginalValue) { if (showOriginValue) {
displayValue = value[activeIndex] displayValue = value[activeIndex]
} else { } else {
const sum = value.reduce((all, v) => all + v, 0) const sum = value.reduce((all, v) => all + v, 0)
@ -140,7 +140,7 @@ export default {
} }
return { return {
content: showOriginalValue ? '{nt}' : '{nt}%', content: showOriginValue ? '{nt}' : '{nt}%',
number: [displayValue], number: [displayValue],
style: digitalFlopStyle, style: digitalFlopStyle,
toFixed: digitalFlopToFixed toFixed: digitalFlopToFixed