当前位置: 首页 > Web前端 > vue.js

vue项目中使用mathjs(精度计算题)

时间:2023-04-01 02:14:04 vue.js

1.安装cnpminstallmathjs--save2。Import*asmathfrom'mathjs'intomain.js//新版本需要这样引入。感谢您在评论区指出Vue。prototype.$math=math3,usethis.$math.round(3.1415926,3)//roundtokeep3decimalplaces4,usethedocumentationhttps://mathjs.org/docs/refer...有问题withlocaldebugging没问题发布到网上后,会报错UncaughtSyntaxError:In"GeV^-2","^"mustbefollowedbyafloating-pointnumber解决方法:fixedversion"mathjs":"8.1.0"