| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // 小数展示,保留五位小数 |
| | | export const formatNumber = (num) => { |
| | | if (typeof (num) !== 'number') { |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | // 保留五位小数 |
| | | export const formatNumberToFixedFive = (num) => { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | export const formatMoney = (val) => { |
| | | if(val === 0){ |
| | | return 0 |
| | |
| | | return (val / Math.pow(num, 4)).toFixed(2) + "T"; //T |
| | | } |
| | | |
| | | |
| | | export const formatNews = (str) => { |
| | | if(!str) { |
| | | return '' |
| | | } |
| | | return str.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/g, '').replace(/ /ig, '') |
| | | } |
| | | |
| | | export const formatWithCommas = (num) => { |
| | | if (num === null || num === undefined || isNaN(num)) return '--'; |
| | | return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); |
| | | } |