js res


  • cross-env 跨平台设置和使用环境变量

设置

{
  "scripts": {
    "build": "cross-env NODE_ENV=production webpack --config build/webpack.config.js"
  }
}

使用

const NODE_ENV = process.env.NODE_ENV;
if(NODE_ENV==='production'){
}else{
}

参考:
https://www.jianshu.com/p/696bd579f9ec
https://blog.csdn.net/qq_26927285/article/details/78105510
https://github.com/kentcdodds/cross-env


加解密

https://github.com/brix/crypto-js


  • 金额计算

bignumber.js

A JavaScript library for arbitrary-precision decimal and non-decimal arithmetic.

0.3 - 0.1                           // 0.19999999999999998
x = new BigNumber(0.3)
x.minus(0.1)                        // "0.2"
x                                   // "0.3"

参考:
https://github.com/MikeMcl/bignumber.js

decimal.js

An arbitrary-precision Decimal type for JavaScript.

A Decimal is immutable in the sense that it is not changed by its methods.

0.3 - 0.1                     // 0.19999999999999998
x = new Decimal(0.3)
x.minus(0.1)                  // '0.2'
x                             // '0.3'

参考:
https://github.com/MikeMcl/decimal.js
http://mikemcl.github.io/decimal.js/
JS判断是不是Decimal类型(正则实现) https://www.cnblogs.com/xachary/p/3631178.html


  • crypto

JavaScript library of crypto standards.

加解密

https://github.com/brix/crypto-js


js操作


  • lodash

Lodash makes JavaScript easier by taking the hassle out of working with arrays,
numbers, objects, strings, etc. Lodash’s modular methods are great for:

  • Iterating arrays, objects, & strings
  • Manipulating & testing values
  • Creating composite functions

lodash之Array方法 https://www.cnblogs.com/shikelong/p/4489615.html
https://github.com/lodash/lodash


  • 二维地图

可能mapbox更优秀一些;

二维地图展示以及添加图标、文本、连线、弹窗等功能实现

二维地图展示以及添加图标、文本、连线、弹窗等功能实现 https://www.jianshu.com/p/0e6f67380ad1

http://www.mapbox.cn/
http://www.mapbox.cn/mapbox-gl-js/example/popup-on-click/
https://www.mapbox.com/

OpenLayers 官网例子的中文详解 https://segmentfault.com/a/1190000009679800
https://openlayers.org/en/latest/examples/vector-layer.html

https://leafletjs.com/
https://leafletjs.com/examples.html
https://leafletjs.com/examples/quick-start/

https://lbsyun.baidu.com/index.php?title=jspopularGL/guide/infoWindow
https://lbsyun.baidu.com/jsdemo.htm#webgl1_4


  • 3D地图

mars3d http://www.mars3d.cn/doc
Cesium https://cesium.com/platform/cesiumjs/


  • 使用百度获取地理位置信息-当前定位

使用百度获取地理位置信息-当前定位 https://www.jianshu.com/p/8dc84db3a616


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容