react保留有效数字小工具

const toFixed = ( dight, bits = 3 ) => {
  return Math.round( dight * Math.pow( 10, bits ) ) / Math.pow( 10, bits )
}

export default {
  toFixed
}

 

posted @ 2017-05-11 11:25  slardarr  阅读(1615)  评论(0编辑  收藏  举报