perf: 避免表格被选中单元格更新的事件重复触发

This commit is contained in:
pipipi-pikachu 2021-06-09 17:53:50 +08:00
parent 443607170a
commit 2b18c36f84

View File

@ -73,6 +73,7 @@
<script lang="ts">
import { computed, defineComponent, nextTick, onMounted, onUnmounted, PropType, ref, watch } from 'vue'
import debounce from 'lodash/debounce'
import isEqual from 'lodash/isEqual'
import { useStore } from '@/store'
import { PPTElementOutline, TableCell, TableTheme } from '@/types/slides'
import { ContextmenuItem } from '@/components/Contextmenu/types'
@ -196,7 +197,8 @@ export default defineComponent({
return selectedCells
})
watch(selectedCells, () => {
watch(selectedCells, (value, oldValue) => {
if (isEqual(value, oldValue)) return
emit('changeSelectedCells', selectedCells.value)
})