 
- Lodash Tutorial
- Lodash - Home
- Lodash - Overview
- Lodash - Environment Setup
- Lodash - Array
- Lodash - Collection
- Lodash - Date
- Lodash - Function
- Lodash - Lang
- Lodash - Math
- Lodash - Number
- Lodash - Object
- Lodash - Seq
- Lodash - String
- Lodash - Util
- Lodash - Properties
- Lodash - Methods
- Lodash Useful Resources
- Lodash - Quick Guide
- Lodash - Useful Resources
- Lodash - Discussion
Lodash - 快速指南
Lodash - 概述
Lodash 是一个流行的基于 javascript 的库,它提供了 200 多个函数来促进 Web 开发。它提供了辅助函数,如映射、过滤器、调用以及函数绑定、JavaScript 模板、深度相等检查、创建索引等。Lodash 可以直接在浏览器中使用,也可以与 Node.js 一起使用。
使用 JavaScript 处理对象可能非常具有挑战性,特别是当您需要对它们进行大量操作时。Lodash 具有许多功能,可以简化您处理对象的工作。
Lodash 是一个开源项目,您可以轻松地为库做出贡献并以插件的形式添加功能,并使其在 GitHub 和 Node.js 中可用。
特征
让我们详细了解 Lodash 提供的所有重要功能 -
收藏
Lodash 为集合提供了各种函数,例如 every、map、reduce,用于对集合的每个项目应用操作。它提供了像 groupBy、countBy、max、min 这样的方法来处理集合并简化大量任务。
数组
Lodash 为数组提供了各种函数,例如迭代和处理数组,如first、initial、lastIndexOf、intersection、difference 等。
功能
Lodash提供了bind、delay、before、after等功能。
对象
Lodash 提供了操作对象、映射对象和比较对象的函数。例如,键、值、extends、extendsOwn、isEqual、isEmpty 等。
公用事业
Lodash 提供了各种实用方法,例如 noConflict、random、iteratee、escape 等。
链接
Lodash 提供了链接方法,例如 chain、value。
在后续章节中,我们将介绍 Lodash 的重要功能
Lodash - 环境设置
在本章中,您将详细了解如何在本地计算机上设置 Lodash 的工作环境。在开始使用 Lodash 之前,您需要有权访问该库。您可以通过以下任何方法访问其文件 -
方法一:在浏览器中使用Lodash文件
在这种方法中,我们需要从其官方网站获取 Lodash 文件,并直接在浏览器中使用它。
步骤1
第一步,访问 Lodash 的官方网站https://lodash.com/。
请注意,有一个可用的下载选项,它为您提供最新的 lodash.min.js 文件CDN 副本。单击链接并选择 lodash.min.js 的最新链接。
第2步
现在,在script标签中包含lodash.min.js并开始使用 Lodash。为此,您可以使用下面给出的代码 -
<script type = "text/JavaScript" src = "https://cdn.jsdelivr.net/npm/lodash@4.17.20/lodash.min.js"> </script>
这里给出一个工作示例及其输出,以便更好地理解 -
例子
<html>
   <head>
      <title>Lodash - Working Example</title>
      <script type = "text/JavaScript" src = "https://cdn.jsdelivr.net/npm/lodash@4.17.20/lodash.min.js"></script>
      <style>
         div {
            border: solid 1px #ccc;
            padding:10px;
            font-family: "Segoe UI",Arial,sans-serif;
            width: 50%;
         }
      </style>
   </head>
   <body>
      <div style = "font-size:25px" id = "list"></div>
      <script type = "text/JavaScript">
         var numbers = [1, 2, 3, 4];
         var listOfNumbers = '';
         _.each(numbers, function(x) { listOfNumbers += x + ' ' });
         document.getElementById("list").innerHTML = listOfNumbers;
      </script>
   </body>
</html>
输出
方法2:使用Node.js
如果您选择此方法,请确保您的系统上安装了Node.js和npm。您可以使用以下命令来安装 Lodash -
npm install lodash
Lodash 安装成功后,您可以观察到以下输出 -
+ lodash@4.17.20 added 1 package from 2 contributors and audited 1 package in 2.54s found 0 vulnerabilities
现在,要测试 Lodash 是否可以与 Node.js 一起正常工作,请创建文件 tester.js 并向其中添加以下代码 -
var _ = require('lodash');
var numbers = [1, 2, 3, 4];
var listOfNumbers = '';
_.each(numbers, function(x) { listOfNumbers += x + ' ' });
console.log(listOfNumbers);
将上述程序保存在tester.js中。以下命令用于编译和执行该程序。
命令
\>node tester.js
输出
1 2 3 4
Lodash - 数组
Lodash 有许多易于使用的方法,有助于处理数组。本章详细讨论它们。
Lodash 提供了各种处理数组的方法,如下所示:
| 先生。 | 方法和语法 | 
|---|---|
| 1 | _.chunk(数组,[大小=1]) | 
| 2 | _.紧凑(数组) | 
| 3 | _.concat(数组,[值]) | 
| 4 | _.difference(数组, [值]) | 
| 5 | _.differenceBy(数组,[值],[iteratee=_.identity]) | 
| 6 | _.differenceWith(数组,[值],[比较器]) | 
| 7 | _.drop(数组,[n=1]) | 
| 8 | _.dropRight(数组,[n=1]) | 
| 9 | _.dropRightWhile(数组,[谓词=_.identity]) | 
| 10 | _.dropWhile(数组,[谓词=_.identity]) | 
| 11 | _.fill(数组,值,[开始=0],[结束=数组.长度]) | 
| 12 | _.findIndex(数组,[谓词=_.identity],[fromIndex=0]) | 
| 13 | _.findLastIndex(array, [predicate=_.identity], [fromIndex=array.length-1]) | 
| 14 | _.展平(数组) | 
| 15 | _.flattenDeep(数组) | 
| 16 | _.flattenDepth(数组,[深度=1]) | 
| 17 号 | _.fromPairs(对) | 
| 18 | _.head(数组) | 
| 19 | _.indexOf(数组,值,[fromIndex=0]) | 
| 20 | _.initial(数组) | 
| 21 | _.intersection([数组]) | 
| 22 | _.intersectionBy([数组], [iteratee=_.identity]) | 
| 23 | _.intersectionWith([数组], [比较器]) | 
| 24 | _.join(数组, [分隔符=',']) | 
| 25 | _.last(数组) | 
| 26 | _.lastIndexOf(数组,值,[fromIndex=array.length-1]) | 
| 27 | _.nth(数组, [n=0]) | 
| 28 | _.pull(数组,[值]) | 
| 29 | _.pullAll(数组,值) | 
| 30 | _.pullAllBy(数组,值,[iteratee=_.identity]) | 
| 31 | _.pullAllWith(数组,值,[比较器]) | 
| 32 | _.pullAt(数组, [索引]) | 
| 33 | _.remove(数组,[谓词=_.identity]) | 
| 34 | _.reverse(数组) | 
| 35 | _.slice(数组, [start=0], [end=array.length]) | 
| 36 | _.sortedIndex(数组,值) | 
| 37 | _.sortedIndexBy(数组,值,[iteratee=_.identity]) | 
| 38 | _.sortedIndexOf(数组,值) | 
| 39 | _.sortedLastIndex(数组,值) | 
| 40 | _.sortedLastIndexBy(数组,值,[iteratee=_.identity]) | 
| 41 | _.sortedLastIndexOf(数组,值) | 
| 42 | _.sortedUniq(数组) | 
| 43 | _.sortedUniqBy(数组, [iteratee]) | 
| 44 | _.tail(数组) | 
| 45 | _.take(数组,[n=1]) | 
| 46 | _.takeRight(数组,[n=1]) | 
| 47 | _.takeRightWhile(数组,[谓词=_.identity]) | 
| 48 | _.takeWhile(数组,[谓词=_.identity]) | 
| 49 | _.union([数组]) | 
| 50 | _.unionBy([数组], [iteratee=_.identity]) | 
| 51 | _.unionWith([数组], [比较器]) | 
| 52 | _.uniq(数组) | 
| 53 | _.uniqBy(数组, [iteratee=_.identity]) | 
| 54 | _.uniqWith(数组,[比较器]) | 
| 55 | _.unzip(数组) | 
| 56 | _.unzipWith(数组, [iteratee=_.identity]) | 
| 57 | _.without(数组, [值]) | 
| 58 | _.xor([数组]) | 
| 59 | _.xorBy([数组], [iteratee=_.identity]) | 
| 60 | _.xorWith([数组], [比较器]) | 
| 61 | _.zip([数组]) | 
| 62 | _.zipObject([属性=[]],[值=[]]) | 
| 63 | _.zipObjectDeep([props=[]], [values=[]]) | 
| 64 | _.zipWith([数组], [iteratee=_.identity]) | 
Lodash - 收藏
Lodash 有许多易于使用的方法,有助于处理集合。本章详细讨论它们。
Lodash 提供了各种方法来处理集合,如下所示 -
| 先生。 | 方法和语法 | 
|---|---|
| 1 | _.countBy(集合, [iteratee=_.identity]) | 
| 2 | _.every(集合, [谓词=_.identity]) | 
| 3 | _.filter(集合, [谓词=_.identity]) | 
| 4 | _.find(集合, [谓词=_.identity], [fromIndex=0]) | 
| 5 | _.findLast(集合, [谓词=_.identity], [fromIndex=collection.length-1]) | 
| 6 | _.flatMap(集合, [iteratee=_.identity]) | 
| 7 | _.flatMapDeep(集合, [iteratee=_.identity]) | 
| 8 | _.flatMapDepth(集合, [iteratee=_.identity], [深度=1]) | 
| 9 | _.forEach(集合, [iteratee=_.identity]) | 
| 10 | _.forEachRight(集合, [iteratee=_.identity]) | 
| 11 | _.groupBy(集合, [iteratee=_.identity]) | 
| 12 | _.includes(集合, 值, [fromIndex=0]) | 
| 13 | _.invokeMap(集合、路径、[args]) | 
| 14 | _.keyBy(集合, [iteratee=_.identity]) | 
| 15 | _.map(集合, [iteratee=_.identity]) | 
| 16 | _.orderBy(集合, [iteratees=[_.identity]], [订单]) | 
| 17 号 | _.partition(集合, [谓词=_.identity]) | 
| 18 | _.reduce(集合, [iteratee=_.identity], [累加器]) | 
| 19 | _.reduceRight(集合, [iteratee=_.identity], [累加器]) | 
| 20 | _.reject(集合, [谓词=_.identity]) | 
| 21 | _。样品采集) | 
| 22 | _.sampleSize(集合,[n=1]) | 
| 23 | _.shuffle(集合) | 
| 24 | _.size(集合) | 
| 25 | _.some(集合, [谓词=_.identity]) | 
| 26 | _.sortBy(集合, [iteratees=[_.identity]]) | 
Lodash - 日期
Lodash 提供了 now 函数来获取当前时间(以毫秒为单位)。
句法
_.now()
获取自 Unix 纪元(1970 年 1 月 1 日 00:00:00 UTC)以来经过的毫秒数的时间戳。
输出
- (number) - 返回时间戳。 
例子
var _ = require('lodash');
var result = _.now();
console.log(result);
将上述程序保存在tester.js中。运行以下命令来执行该程序。
命令
\>node tester.js
输出
1601614929848
Lodash - 函数
Lodash 有许多易于使用的方法,有助于创建和处理函数。本章详细讨论它们。
Lodash 提供了各种方法来处理函数,如下所示 -
| 先生。 | 方法和语法 | 
|---|---|
| 1 | _.ary(func, [n=func.length]) | 
| 2 | _.before(n, 函数) | 
| 3 | _.bind(func, thisArg, [部分]) | 
| 4 | _.bindKey(对象, 键, [部分]) | 
| 5 | _.curry(func, [arity=func.length]) | 
| 6 | _.curryRight(func, [arity=func.length]) | 
| 7 | _.delay(func, 等待, [args]) | 
| 8 | _.flip(函数) | 
| 9 | _.memoize(func, [解析器]) | 
| 10 | _.negate(谓词) | 
| 11 | _.once(函数) | 
| 12 | _.overArgs(func, [变换=[_.identity]]) | 
| 13 | _.partial(func, [部分]) | 
| 14 | _.partialRight(func, [部分]) | 
| 15 | _.rearg(函数,索引) | 
| 16 | _.rest(func, [start=func.length-1]) | 
| 17 号 | _.spread(func, [开始=0]) | 
| 18 | _.一元(func) | 
| 19 | _.wrap(值, [包装=身份]) | 
洛达什-朗
Lodash 有许多易于使用的通用方法。本章详细讨论它们。
Lodash 提供了各种通用方法,如下所示 -
| 先生。 | 方法和语法 | 
|---|---|
| 1 | _.castArray(值) | 
| 2 | _.克隆(值) | 
| 3 | _.cloneDeep(值) | 
| 4 | _.conformsTo(对象,源) | 
| 5 | _.eq(值,其他) | 
| 6 | _.gt(值,其他) | 
| 7 | _.gte(值,其他) | 
| 8 | _.isArguments(值) | 
| 9 | _.isArray(值) | 
| 10 | _.isArrayBuffer(值) | 
| 11 | _.isArrayLike(值) | 
| 12 | _.isArrayLikeObject(值) | 
| 13 | _.isBoolean(值) | 
| 14 | _.isBuffer(值) | 
| 15 | _.isDate(值) | 
| 16 | _.isEmpty(值) | 
| 17 号 | _.isEqual(值,其他) | 
| 18 | _.isEqualWith(值, 其他, [定制器]) | 
| 19 | _.isError(值) | 
| 20 | _.isFinite(值) | 
| 21 | _.isFunction(值) | 
| 22 | _.isInteger(值) | 
| 23 | _.isLength(值) | 
| 24 | _.isMap(值) | 
| 25 | _.isMatch(对象,源) | 
| 26 | _.isMatchWith(对象, 源, [定制器]) | 
| 27 | _.isNaN(值) | 
| 28 | _.isNative(值) | 
| 29 | _.isNil(值) | 
| 30 | _.isNull(值) | 
| 31 | _.isNumber(值) | 
| 32 | _.isObject(值) | 
| 33 | _.isObjectLike(值) | 
| 34 | _.isPlainObject(值) | 
| 35 | _.isRegExp(值) | 
| 36 | _.isSafeInteger(值) | 
| 37 | _.isSet(值) | 
| 38 | _.isString(值) | 
| 39 | _.isSymbol(值) | 
| 40 | _.isTypedArray(值) | 
| 41 | _.isUndefined(值) | 
| 42 | _.isWeakMap(值) | 
| 43 | _.isWeakSet(值) | 
| 44 | _.lt(值,其他) | 
| 45 | _.lte(值,其他) | 
| 46 | _.toArray(值) | 
| 47 | _.toFinite(值) | 
| 48 | _.toInteger(值) | 
| 49 | _.toLength(值) | 
| 50 | _.toNumber(值) | 
| 51 | _.toPlainObject(值) | 
| 52 | _.toSafeInteger(值) | 
| 53 | _.toString(值) | 
Lodash - 数学
Lodash 有许多易于使用的数学相关方法。本章详细讨论它们。
Lodash 提供了各种与数学相关的方法,如下所示 -
| 先生。 | 方法和语法 | 
|---|---|
| 1 | _.add(被加数, 加数) | 
| 2 | _.ceil(数字, [精度=0]) | 
| 3 | _.divide(被除数,除数) | 
| 4 | _.floor(数字, [精度=0]) | 
| 5 | _.max(数组) | 
| 6 | _.maxBy(数组, [iteratee=_.identity]) | 
| 7 | _.mean(数组) | 
| 8 | _.meanBy(数组, [iteratee=_.identity]) | 
| 9 | _.min(数组) | 
| 10 | _.minBy(数组, [iteratee=_.identity]) | 
| 11 | _.multiply(乘数,被乘数) | 
| 12 | _.round(数字, [精度=0]) | 
| 13 | _.subtract(被减数, 减数) | 
| 14 | _.sum(数组) | 
| 15 | _.sumBy(数组, [iteratee=_.identity]) | 
Lodash - 数字
Lodash 有许多易于使用的与 Number 相关的方法。本章详细讨论它们。
Lodash 提供了各种与数字相关的方法,如下所示 -
| 先生。 | 方法和语法 | 
|---|---|
| 1 | _.clamp(数字, [下], 上) | 
| 2 | _.inRange(数字, [开始=0], 结束) | 
| 3 | _.random([下=0], [上=1], [浮动]) | 
Lodash - 对象
Lodash 有许多易于使用的与对象相关的方法。本章详细讨论它们。
Lodash 提供了各种与对象相关的方法,如下所示:
| 先生。 | 方法和语法 | 
|---|---|
| 1 | _.分配(对象,[来源]) | 
| 2 | _.assignIn(对象,[来源]) | 
| 3 | _.assignInWith(对象, 来源, [定制器]) | 
| 4 | _.assignWith(对象, 来源, [定制器]) | 
| 5 | _.at(对象,[路径]) | 
| 6 | _.create(原型,[属性]) | 
| 7 | _.defaults(对象, [来源]) | 
| 8 | _.defaultsDeep(对象, [来源]) | 
| 9 | _.findKey(对象, [谓词=_.identity]) | 
| 10 | _.findLastKey(对象, [谓词=_.identity]) | 
| 11 | _.forIn(对象, [iteratee=_.identity]) | 
| 12 | _.forInRight(对象, [iteratee=_.identity]) | 
| 13 | _.forOwn(对象, [iteratee=_.identity]) | 
| 14 | _.forOwnRight(对象, [iteratee=_.identity]) | 
| 15 | _.函数(对象) | 
| 16 | _.functionsIn(对象) | 
| 17 号 | _.get(对象, 路径, [默认值]) | 
| 18 | _.has(对象,路径) | 
| 19 | _.hasIn(对象,路径) | 
| 20 | _.invert(对象) | 
| 21 | _.invertBy(对象, [iteratee=_.identity]) | 
| 22 | _.invoke(对象,路径,[args]) | 
| 23 | _.keys(对象) | 
| 24 | _.keysIn(对象) | 
| 25 | _.mapKeys(对象, [iteratee=_.identity]) | 
| 26 | _.mapValues(对象, [iteratee=_.identity]) | 
| 27 | _.merge(对象,[来源]) | 
| 28 | _.mergeWith(对象、源、定制器) | 
| 29 | _.省略(对象,[路径]) | 
| 30 | _.omitBy(对象, [谓词=_.identity]) | 
| 31 | _.pick(对象,[路径]) | 
| 32 | _.pickBy(对象, [谓词=_.identity]) | 
| 33 | _.结果(对象,路径,[默认值]) | 
| 34 | _.set(对象、路径、值) | 
| 35 | _.setWith(对象、路径、值、[定制器]) | 
| 36 | _.toPairs(对象) | 
| 37 | _.toPairsIn(对象) | 
| 38 | _.transform(对象, [iteratee=_.identity], [累加器]) | 
| 39 | _.unset(对象,路径) | 
| 40 | _.update(对象、路径、更新程序) | 
| 41 | _.updateWith(对象、路径、更新程序、[定制程序]) | 
| 42 | _.values(对象) | 
| 43 | _.valuesIn(对象) | 
Lodash - 序列
Lodash 有许多易于使用的 Sequence 相关方法。本章详细讨论它们。
Lodash 提供了各种与序列相关的方法,如下所示 -
| 先生。 | 方法和语法 | 
|---|---|
| 1 | _.链(值) | 
| 2 | _.tap(值, 拦截器) | 
| 3 | _.thru(值, 拦截器) | 
| 4 | _.prototype[Symbol.iterator]() | 
| 5 | _.prototype.at([路径]) | 
| 6 | _.prototype.chain() | 
| 7 | _.prototype.commit() | 
| 8 | _.prototype.next() | 
| 9 | _.prototype.plant(值) | 
| 10 | _.prototype.reverse() | 
| 11 | _.prototype.value() | 
Lodash - 字符串
Lodash 有许多易于使用的字符串操作方法。本章详细讨论它们。
Lodash 提供了各种与字符串相关的方法,如下所示:
| 先生。 | 方法和语法 | 
|---|---|
| 1 | _.camelCase([字符串='']) | 
| 2 | _.大写([字符串='']) | 
| 3 | _.去毛刺([字符串='']) | 
| 4 | _.endsWith([string=''], [target], [position=string.length]) | 
| 5 | _.escape([字符串='']) | 
| 6 | _.escapeRegExp([字符串='']) | 
| 7 | _.kebabCase([字符串='']) | 
| 8 | _.lowerCase([字符串='']) | 
| 9 | _.lowerFirst([字符串='']) | 
| 10 | _.pad([字符串=''],[长度=0],[字符='']) | 
| 11 | _.padEnd([字符串=''], [长度=0], [字符=' ']) | 
| 12 | _.padStart([字符串=''], [长度=0], [字符=' ']) | 
| 13 | _.parseInt(字符串, [基数=10]) | 
| 14 | _.repeat([字符串=''], [n=1]) | 
| 15 | _.replace([string=''], 模式, 替换) | 
| 16 | _.snakeCase([字符串='']) | 
| 17 号 | _.split([字符串=''], 分隔符, [限制]) | 
| 18 | _.startCase([字符串='']) | 
| 19 | _.startsWith([字符串=''], [目标], [位置=0]) | 
| 20 | _.template([字符串=''], [选项={}]) | 
| 21 | _.toLower([字符串='']) | 
| 22 | _.toUpper([字符串='']) | 
| 23 | _.trim([字符串=''], [字符=空白]) | 
| 24 | _.trimEnd([字符串=''], [字符=空白]) | 
| 25 | _.trimStart([字符串=''], [字符=空白]) | 
| 26 | _.truncate([字符串=''], [选项={}]) | 
| 27 | _.unescape([字符串='']) | 
| 28 | _.upperCase([字符串='']) | 
| 29 | _.upperFirst([字符串='']) | 
| 30 | _.words([字符串=''], [模式]) | 
Lodash - 实用程序
Lodash 有许多易于使用的实用方法。本章详细讨论它们。
Lodash 提供了各种实用方法,如下所列 -
| 先生。 | 方法和语法 | 
|---|---|
| 1 | _.cond(对) | 
| 2 | _.符合(来源) | 
| 3 | _.常量(值) | 
| 4 | _.defaultTo(值, 默认值) | 
| 5 | _.flow([函数]) | 
| 6 | _.flowRight([函数]) | 
| 7 | _.身份(值) | 
| 8 | _.iteratee([func=_.identity]) | 
| 9 | _.matches(来源) | 
| 10 | _.matchesProperty(路径, srcValue) | 
| 11 | _.method(路径, [args]) | 
| 12 | _.methodOf(对象, [args]) | 
| 13 | _.mixin([object=lodash], 源, [options={}]) | 
| 14 | _.noConflict() | 
| 15 | _.noop() | 
| 16 | _.nthArg([n=0]) | 
| 17 号 | _.over([iteratees=[_.identity]]) | 
| 18 | _.overEvery([谓词=[_.identity]]) | 
| 19 | _.overSome([谓词=[_.identity]]) | 
| 20 | _.属性(路径) | 
| 21 | _.propertyOf(对象) | 
| 22 | _.range([开始=0],结束,[步骤=1]) | 
| 23 | _.rangeRight([开始=0],结束,[步骤=1]) | 
| 24 | _.runInContext([上下文=根]) | 
| 25 | _.stubArray() | 
| 26 | _.stubFalse() | 
| 27 | _.stubObject() | 
| 28 | _.stubString() | 
| 29 | _.stubTrue() | 
| 30 | _.times(n, [iteratee=_.identity]) | 
| 31 | _.toPath(值) | 
| 32 | _.uniqueId([前缀='']) | 
Lodash - 属性
本章详细讨论 lodash 属性。
| 先生。 | 方法和语法 | 
|---|---|
| 1 | _.VERSION - (字符串):语义版本号。 | 
| 2 | _.templateSettings - (对象):默认情况下,lodash 使用的模板分隔符类似于嵌入式 Ruby (ERB) 以及 ES2015 模板字符串中的分隔符。更改以下模板设置以使用替代分隔符。 | 
| 3 | _.templateSettings.escape - (RegExp):用于检测要进行 HTML 转义的数据属性值。 | 
| 4 | _.templateSettings.evaluate - (RegExp):用于检测要评估的代码。 | 
| 5 | _.templateSettings.imports - (对象):用于将变量导入到已编译的模板中。 | 
| 6 | _.templateSettings.interpolate - (RegExp):用于检测要注入的数据属性值。 | 
| 7 | _.templateSettings.variable - (字符串):用于引用模板文本中的数据对象。 | 
Lodash - 方法
本章详细讨论 lodash 属性。
| 先生。 | 方法和语法 | 
|---|---|
| 1 | _.VERSION - (字符串):语义版本号。 | 
| 2 | _.templateSettings - (对象):默认情况下,lodash 使用的模板分隔符类似于嵌入式 Ruby (ERB) 以及 ES2015 模板字符串中的分隔符。更改以下模板设置以使用替代分隔符。 | 
| 3 | _.templateSettings.escape - (RegExp):用于检测要进行 HTML 转义的数据属性值。 | 
| 4 | _.templateSettings.evaluate - (RegExp):用于检测要评估的代码。 | 
| 5 | _.templateSettings.imports - (对象):用于将变量导入到已编译的模板中。 | 
| 6 | _.templateSettings.interpolate - (RegExp):用于检测要注入的数据属性值。 | 
| 7 | _.templateSettings.variable - (字符串):用于引用模板文本中的数据对象。 |