perf: optimize ScrooX component.

This commit is contained in:
张传龙
2022-07-09 14:38:38 +08:00
parent a1db8273f5
commit 76c3f0b64c
2 changed files with 26 additions and 41 deletions

View File

@@ -1,5 +1,5 @@
<template>
<ScrollX ref="scrollX" :height="useTheme.tags.height">
<ScrollX :class="`h-${useTheme.tags.height}`">
<n-tag
v-for="tag in tagsStore.tags"
:key="tag.path"
@@ -47,15 +47,6 @@ watch(
{ immediate: true }
)
const scrollX = ref(null)
watch(
() => tagsStore.tags,
async (newVal, oldVal) => {
await nextTick()
scrollX.value?.refreshIsOverflow(newVal.length > oldVal.length)
}
)
const handleTagClick = (path) => {
tagsStore.setActiveTag(path)
router.push(path)