优化博客访问量显示

This commit is contained in:
2024-08-31 15:05:16 +08:00
parent 30e8e89422
commit 7d6e056e6b
2 changed files with 12 additions and 1 deletions

View File

@@ -0,0 +1,9 @@
function formateTimes(times: number) {
if (times < 10000)// 一万以内直接显示
return times;
if (times < 10000 * 10000)// 一亿以内加上 万
return (times / 10000).toFixed(1) + '万'
return (times / 10000 / 10000).toFixed(1) + '亿'
}
export { formateTimes };