From e24434778f6e5bbc3a264df49ebc6606ae43937b Mon Sep 17 00:00:00 2001 From: liuqingqing05 Date: Thu, 3 Sep 2020 14:21:47 +0800 Subject: [PATCH] =?UTF-8?q?fix(tpl):=20registerTplEnginer=E6=8B=BC?= =?UTF-8?q?=E5=86=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.tsx | 22 +++++++++++----------- src/utils/tpl-lodash.ts | 6 +++--- src/utils/tpl.ts | 10 +++++----- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 0dac2a1ca..d457966ad 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -14,20 +14,20 @@ import { clearStoresCache, updateEnv } from './factory'; -import {wrapFetcher, buildApi} from './utils/api'; +import { wrapFetcher, buildApi } from './utils/api'; import { filter, - reigsterTplEnginer, + registerTplEnginer, evalExpression, evalJS, setCustomEvalJs, setCustomEvalExpression } from './utils/tpl'; import * as utils from './utils/helper'; -import {resizeSensor} from './utils/resize-sensor'; -import {setIconVendor} from './renderers/Form/IconPickerIcons'; -import {Icon, registerIcon} from './components/icons'; -import {RegisterStore} from './store'; +import { resizeSensor } from './utils/resize-sensor'; +import { setIconVendor } from './renderers/Form/IconPickerIcons'; +import { Icon, registerIcon } from './components/icons'; +import { RegisterStore } from './store'; import { setDefaultLocale, getDefaultLocale, @@ -140,9 +140,9 @@ import './renderers/IFrame'; import './renderers/QRCode'; import './renderers/Icon'; import './renderers/Carousel'; -import Scoped, {ScopedContext} from './Scoped'; +import Scoped, { ScopedContext } from './Scoped'; -import {FormItem} from './renderers/Form/Item'; +import { FormItem } from './renderers/Form/Item'; // 兼容旧版本用法 import './compat'; @@ -163,8 +163,8 @@ import { validate, validateObject } from './utils/validations'; -import {normalizeOptions} from './components/Select'; -import {OptionsControl} from './renderers/Form/Options'; +import { normalizeOptions } from './components/Select'; +import { OptionsControl } from './renderers/Form/Options'; import { classnames, @@ -192,7 +192,7 @@ export { utils, resizeSensor, registerFilter, - reigsterTplEnginer, + registerTplEnginer, evalExpression, evalJS, setCustomEvalJs, diff --git a/src/utils/tpl-lodash.ts b/src/utils/tpl-lodash.ts index 86552ff99..9cf3cd3b7 100644 --- a/src/utils/tpl-lodash.ts +++ b/src/utils/tpl-lodash.ts @@ -1,6 +1,6 @@ -import {reigsterTplEnginer, filter, Enginer} from './tpl'; +import { registerTplEnginer, filter, Enginer } from './tpl'; import template from 'lodash/template'; -import {getFilters} from './tpl-builtin'; +import { getFilters } from './tpl-builtin'; import React from 'react'; import moment from 'moment'; @@ -47,7 +47,7 @@ function lodashCompile(str: string, data: object) { } } -export function register(): Enginer & {name: string} { +export function register(): Enginer & { name: string } { return { name: 'lodash', test: (str: string) => !!~str.indexOf('<%'), diff --git a/src/utils/tpl.ts b/src/utils/tpl.ts index 6529a0aa1..089ab563f 100644 --- a/src/utils/tpl.ts +++ b/src/utils/tpl.ts @@ -1,6 +1,6 @@ -import {createObject} from './helper'; -import {register as registerBulitin, getFilters} from './tpl-builtin'; -import {register as registerLodash} from './tpl-lodash'; +import { createObject } from './helper'; +import { register as registerBulitin, getFilters } from './tpl-builtin'; +import { register as registerLodash } from './tpl-lodash'; export interface Enginer { test: (tpl: string) => boolean; @@ -11,7 +11,7 @@ const enginers: { [propName: string]: Enginer; } = {}; -export function reigsterTplEnginer(name: string, enginer: Enginer) { +export function registerTplEnginer(name: string, enginer: Enginer) { enginers[name] = enginer; } @@ -105,7 +105,7 @@ export function evalJS(js: string, data: object): any { [registerBulitin, registerLodash].forEach(fn => { const info = fn(); - reigsterTplEnginer(info.name, { + registerTplEnginer(info.name, { test: info.test, compile: info.compile });