diff --git a/package.json b/package.json index 9bf2b9b599..554f064217 100644 --- a/package.json +++ b/package.json @@ -86,12 +86,12 @@ "dependencies": { "@babel/runtime": "^7.22.6", "@popperjs/core": "^2.11.8", - "@types/lodash": "4.14.182", + "@types/lodash-es": "^4.17.12", "@types/sortablejs": "^1.15.1", "@types/tinycolor2": "^1.4.3", "@types/validator": "^13.7.17", "dayjs": "1.11.10", - "lodash": "^4.17.21", + "lodash-es": "^4.17.21", "mitt": "^3.0.1", "sortablejs": "^1.15.0", "tdesign-icons-vue-next": "^0.3.4", diff --git a/script/init/index.js b/script/init/index.js index 22a27e9ab3..6785a49754 100644 --- a/script/init/index.js +++ b/script/init/index.js @@ -27,7 +27,7 @@ const fs = require('fs'); const path = require('path'); -const _ = require('lodash'); +const { template } = require('lodash-es'); const utils = require('../utils'); const config = require('./config'); @@ -75,20 +75,20 @@ function deleteComponent(toBeCreatedFiles, component) { function outputFileWithTemplate(item, component, desc, _d) { const tplPath = path.resolve(__dirname, `./tpl/${item.template}`); let data = fs.readFileSync(tplPath).toString(); - const compiled = _.template(data); + const compiled = template(data); data = compiled({ component, upperComponent: getFirstLetterUpper(component), }); - const _f = path.resolve(_d, item.file); - createFile(_f, data, desc); + const fFn = path.resolve(_d, item.file); + createFile(fFn, data, desc); } function addComponent(toBeCreatedFiles, component) { // At first, we need to create directories for components. Object.keys(toBeCreatedFiles).forEach((dir) => { - const _d = path.resolve(cwdPath, dir); - fs.mkdir(_d, { recursive: true }, (err) => { + const dFn = path.resolve(cwdPath, dir); + fs.mkdir(dFn, { recursive: true }, (err) => { if (err) { utils.log(err, 'error'); return; @@ -102,8 +102,8 @@ function addComponent(toBeCreatedFiles, component) { outputFileWithTemplate(item, component, contents.desc, _d); } } else { - const _f = path.resolve(_d, item); - createFile(_f, '', contents.desc); + const fFn = path.resolve(_d, item); + createFile(fFn, '', contents.desc); } }); }); diff --git a/src/affix/affix.tsx b/src/affix/affix.tsx index d1700dfab9..4c3819c2b2 100644 --- a/src/affix/affix.tsx +++ b/src/affix/affix.tsx @@ -1,6 +1,6 @@ import { ref, watch, nextTick, onMounted, onBeforeUnmount, defineComponent, onActivated, onDeactivated } from 'vue'; -import isFunction from 'lodash/isFunction'; -import isUndefined from 'lodash/isUndefined'; +import { isFunction } from 'lodash-es'; +import { isUndefined } from 'lodash-es'; import { on, off, getScrollContainer } from '../utils/dom'; import props from './props'; diff --git a/src/alert/alert.tsx b/src/alert/alert.tsx index 6aec3ad6ec..d8f51ee188 100644 --- a/src/alert/alert.tsx +++ b/src/alert/alert.tsx @@ -6,8 +6,8 @@ import { HelpCircleFilledIcon as TdHelpCircleFilledIcon, InfoCircleFilledIcon as TdInfoCircleFilledIcon, } from 'tdesign-icons-vue-next'; -import isString from 'lodash/isString'; -import isArray from 'lodash/isArray'; +import { isString } from 'lodash-es'; +import { isArray } from 'lodash-es'; import { on, off, addClass } from '../utils/dom'; import props from './props'; diff --git a/src/anchor/_example-ts/base.vue b/src/anchor/_example-ts/base.vue index d28cff12df..4ae58ad129 100644 --- a/src/anchor/_example-ts/base.vue +++ b/src/anchor/_example-ts/base.vue @@ -12,7 +12,7 @@ diff --git a/src/anchor/_example-ts/container.vue b/src/anchor/_example-ts/container.vue index c5a1b460e8..31a7a6821c 100644 --- a/src/anchor/_example-ts/container.vue +++ b/src/anchor/_example-ts/container.vue @@ -18,7 +18,7 @@ diff --git a/src/anchor/_example-ts/custom-scroll.vue b/src/anchor/_example-ts/custom-scroll.vue index b74c09cc18..143b5fd739 100644 --- a/src/anchor/_example-ts/custom-scroll.vue +++ b/src/anchor/_example-ts/custom-scroll.vue @@ -12,7 +12,7 @@ diff --git a/src/anchor/_example-ts/multiple.vue b/src/anchor/_example-ts/multiple.vue index c0c8053b0a..f3d772f3f2 100644 --- a/src/anchor/_example-ts/multiple.vue +++ b/src/anchor/_example-ts/multiple.vue @@ -14,7 +14,7 @@ diff --git a/src/anchor/_example-ts/small.vue b/src/anchor/_example-ts/small.vue index 5c8cb9952c..691d4efbf9 100644 --- a/src/anchor/_example-ts/small.vue +++ b/src/anchor/_example-ts/small.vue @@ -13,7 +13,7 @@ diff --git a/src/anchor/_example-ts/target.vue b/src/anchor/_example-ts/target.vue index c5915e68a3..9777d7f999 100644 --- a/src/anchor/_example-ts/target.vue +++ b/src/anchor/_example-ts/target.vue @@ -12,7 +12,7 @@ diff --git a/src/anchor/_example/base.vue b/src/anchor/_example/base.vue index 3b0e4ec959..5cb8fa3b4b 100644 --- a/src/anchor/_example/base.vue +++ b/src/anchor/_example/base.vue @@ -12,7 +12,7 @@