From 3ce67a614cb029c0702f9424c99a6670867db0d8 Mon Sep 17 00:00:00 2001 From: 07akioni <07akioni2@gmail.com> Date: Tue, 4 Feb 2020 18:40:36 +0800 Subject: [PATCH] perf(transfer): remove some clone overhead --- packages/common/Transfer/src/Transfer.vue | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/common/Transfer/src/Transfer.vue b/packages/common/Transfer/src/Transfer.vue index 955ecda6b..4d31649ad 100644 --- a/packages/common/Transfer/src/Transfer.vue +++ b/packages/common/Transfer/src/Transfer.vue @@ -155,7 +155,6 @@ import NTransferHeaderExtra from './TransferHeaderExtra' import NTransferSourceListItem from './TransferSourceListItem' import NTransferTargetListItem from './TransferTargetListItem' import NTransferButton from './TransferButton' -import cloneDeep from 'lodash/cloneDeep' import asformitem from '../../../mixins/asformitem' import withapp from '../../../mixins/withapp' import themeable from '../../../mixins/themeable' @@ -276,7 +275,7 @@ export default { valueToOptionMap () { const map = new Map() this.options.forEach(option => { - map.set(option.value, { ...option }) + map.set(option.value, option) }) return map }, @@ -334,7 +333,7 @@ export default { options (newOptions) { this.initialized = false const valueSet = this.valueSet - this.memorizedSourceOptions = cloneDeep(this.options.filter(option => !valueSet.has(option.value))) + this.memorizedSourceOptions = this.options.filter(option => !valueSet.has(option.value)) this.sourceCheckedValues = [] this.targetCheckedValues = [] this.$nextTick().then(() => { @@ -347,7 +346,7 @@ export default { }, created () { const valueSet = this.valueSet - this.memorizedSourceOptions = cloneDeep(this.options.filter(option => !valueSet.has(option.value))) + this.memorizedSourceOptions = this.options.filter(option => !valueSet.has(option.value)) }, methods: { emitChangeEvent (value) {