mirror of
https://github.com/pipipi-pikachu/PPTist.git
synced 2025-04-15 02:20:00 +08:00
perf: 优化搜索替换体验
This commit is contained in:
parent
c41f23a2f3
commit
3528368507
@ -13,7 +13,7 @@
|
|||||||
:class="{ 'active': type === tab.key }"
|
:class="{ 'active': type === tab.key }"
|
||||||
v-for="tab in tabs"
|
v-for="tab in tabs"
|
||||||
:key="tab.key"
|
:key="tab.key"
|
||||||
@click="type = tab.key"
|
@click="changeTab(tab.key)"
|
||||||
@mousedown.stop
|
@mousedown.stop
|
||||||
>{{tab.label}}</div>
|
>{{tab.label}}</div>
|
||||||
</div>
|
</div>
|
||||||
@ -37,7 +37,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, ref } from 'vue'
|
import { nextTick, onMounted, ref } from 'vue'
|
||||||
import { useMainStore } from '@/store'
|
import { useMainStore } from '@/store'
|
||||||
import useSearch from '@/hooks/useSearch'
|
import useSearch from '@/hooks/useSearch'
|
||||||
import MoveablePanel from '@/components/MoveablePanel.vue'
|
import MoveablePanel from '@/components/MoveablePanel.vue'
|
||||||
@ -80,6 +80,13 @@ const searchInpRef = ref<HTMLInputElement>()
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
searchInpRef.value!.focus()
|
searchInpRef.value!.focus()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const changeTab = (key: TypeKey) => {
|
||||||
|
type.value = key
|
||||||
|
nextTick(() => {
|
||||||
|
searchInpRef.value!.focus()
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user