瀏覽代碼

首页金额

e 5 年之前
父節點
當前提交
9eb9656eb6
共有 1 個文件被更改,包括 10 次插入1 次删除
  1. 10 1
      src/views/dashboard/admin/components/RaddarChart.vue

+ 10 - 1
src/views/dashboard/admin/components/RaddarChart.vue

@@ -85,7 +85,16 @@ export default {
             color: '#545454',
             lineHeight: 22,
             formatter: function(param) {
-              return param.name + '(' + Math.round(param.percent) + '%' + ')' + '\n¥' + param.value + ''
+              let result = (+param.value || 0).toString().replace(/^-?\d+/g, m => m.replace(/(?=(?!\b)(\d{3})+$)/g, ','))
+              const temp = result.split('.')
+              if (temp.length === 1) {
+                result += '.00'
+              } else if (temp.length > 1) {
+                if (temp[1].length < 2) {
+                  result += '0'
+                }
+              }
+              return param.name + '(' + Math.round(param.percent) + '%' + ')' + '\n¥' + result
             }
           },
           labelLine: {