我正在使用HTML script
标签在我的HTML网页中包含lodash v.4.17.11 js文件。
<body>
...
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.core.min.js"></script>
</body>
诸如_.filter
之类的某些功能可以正常工作,但_.remove
给我带来的好处:
Uncaught TypeError: _.remove is not a function
。
该函数似乎在库文件中不存在!尽管已在文档中列出。
答案 0 :(得分:3)
您正在使用core
库。似乎您不仅需要core
:
代替:
https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.core.min.js
使用:
https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.min.js
以下是有关差异的更多详细信息:
https://github.com/lodash/lodash/wiki/Build-Differences
为方便起见:
4 kB(压缩后)内核构建(63种方法;主干≥v1.3.0兼容)
_.assignIn, _.before, _.bind, _.chain, _.clone, _.compact, _.concat, _.create, _.defaults, _.defer, _.delay, _.each, _.escape, _.every, _.filter, _.find, _.flatten, _.flattenDeep, _.forEach, _.has, _.head, _.identity, _.indexOf, _.isArguments, _.isArray, _.isBoolean, _.isDate, _.isEmpty, _.isEqual, _.isFinite, _.isFunction, _.isNaN, _.isNull, _.isNumber, _.isObject, _.isRegExp, _.isString, _.isUndefined, _.iteratee, _.keys, _.last, _.map, _.matches, _.max, _.min, _.mixin, _.negate, _.noConflict, _.noop, _.once, _.pick, _.reduce, _.result, _.size, _.slice, _.some, _.sortBy, _.tap, _.thru, _.toArray, _.uniqueId, _#value, & _.values
限制: