Browse Source

refactor:使用lodash-es

wumuwumu 5 years ago
parent
commit
a9df33d633
4 changed files with 5 additions and 11 deletions
  1. 1 1
      package.json
  2. 1 4
      src/lib/api.js
  3. 1 1
      src/lib/loadScript.js
  4. 2 5
      src/lib/webservice.js

+ 1 - 1
package.json

@@ -20,7 +20,7 @@
   },
   "dependencies": {
     "classnames": "^2.2.6",
-    "lodash": "^4.17.11",
+    "lodash-es": "^4.17.15",
     "react": "^16.4.1",
     "react-dom": "^16.4.1",
     "react-scripts": "2.0.5"

+ 1 - 4
src/lib/api.js

@@ -1,7 +1,4 @@
-import forOwn from "lodash/forOwn";
-import isEqual from "lodash/isEqual";
-import isNil from "lodash/isNil";
-import isEmpty from "lodash/isEmpty";
+import {isEmpty,isNil,isEqual,forOwn} from "lodash-es"
 //import loadjscssfile from './loadScript';
 import APILoader from "./APILoader";
 

+ 1 - 1
src/lib/loadScript.js

@@ -1,7 +1,7 @@
 /**
  * see: http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml
  */
-import indexOf from 'lodash/indexOf';
+import { indexOf } from "lodash-es";
 
 let gFileList = []; //list of files already added
 const loadjscssfile = (filename, filetype) => {

+ 2 - 5
src/lib/webservice.js

@@ -1,7 +1,4 @@
-import forOwn from 'lodash/forOwn';
-import isEqual from 'lodash/isEqual';
-import isNil from 'lodash/isNil';
-import isUndefined from 'lodash/isUndefined';
+import { isUndefined, isNil, isEqual, forOwn } from "lodash-es";
 
 // M: Mandatory,必选
 // api调用限流说明: https://lbs.amap.com/api/webservice/guide/tools/flowlevel
@@ -395,4 +392,4 @@ export const getRequest = (serviceId, parameters, body) => {
     url, 
     option
   }
-}
+}