不知道你们有没有踩过,js运算时出现多位小数的坑,比如 22.77+10,结果竟然是32.769999999996。
目前我的解决方案是这样的:
首先将小数变成整数,然后再除于相应的倍数。比如上面的计算可以写成((22.77×100)+(10×100))/100
|
|
技术改变生活,分享沉淀自我
缺失模块。
1、在博客根目录(注意不是yilia根目录)执行以下命令:
npm i hexo-generator-json-content --save
2、在根目录_config.yml里添加配置:
jsonContent:
meta: false
pages: false
posts:
title: true
date: true
path: true
text: true
raw: false
content: false
slug: false
updated: false
comments: false
link: false
permalink: false
excerpt: false
categories: false
tags: true