Explorar o código

fix round number

Michael Wang %!s(int64=3) %!d(string=hai) anos
pai
achega
c4f247cf72
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/directives/numberToPercent.ts

+ 1 - 1
src/directives/numberToPercent.ts

@@ -4,7 +4,7 @@ export default {
     // console.log(el, binding, vnode, prevVnode);
     const ft = parseFloat(el.innerText);
     if (typeof ft === "number") {
-      el.innerText = (Math.round(ft * 10000) / 10000) * 100 + "%";
+      el.innerText = (Math.round(ft * 10000) / 100).toFixed(2) + "%";
     }
   }, // new
   beforeMount() {},