Commit e802f534 authored by 郭铭瑶's avatar 郭铭瑶 🤘

完善input

parent feac0aa8
...@@ -69,7 +69,8 @@ ...@@ -69,7 +69,8 @@
</div> </div>
</n-collapse-item> </n-collapse-item>
</n-collapse> </n-collapse>
<div class="tag-box"> <m-animate enter="fadeInUp" leave="fadeOutDown" :duration="100">
<div v-if="visible" class="tag-box">
<span <span
v-for="tag in tagList" v-for="tag in tagList"
:key="tag.name" :key="tag.name"
...@@ -78,12 +79,23 @@ ...@@ -78,12 +79,23 @@
>{{ tag.name }}</span >{{ tag.name }}</span
> >
</div> </div>
</m-animate>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ChartTypes } from '@/components/MyComponent' import { ChartTypes } from '@/components/MyComponent'
import { ref } from '@vue/reactivity' import { ref, PropType, computed } from 'vue'
const props = defineProps({
visible: {
type: Boolean as PropType<boolean>,
default: true,
},
})
const visible = computed(() => props.visible)
const sumList = [ const sumList = [
{ name: '党组织', value: 355, unit: '个' }, { name: '党组织', value: 355, unit: '个' },
{ name: '关系在街道内党员', value: 10890, unit: '位' }, { name: '关系在街道内党员', value: 10890, unit: '位' },
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
:loading="isLoading" :loading="isLoading"
clearable clearable
:on-clear="removeResult" :on-clear="removeResult"
:on-focus="() => emit('focus')"
:on-blur="() => emit('blur')"
> >
<template #prefix> <template #prefix>
<img class="icon" src="@images/search2.png" /> <img class="icon" src="@images/search2.png" />
...@@ -58,6 +60,8 @@ import { ref, watch } from 'vue' ...@@ -58,6 +60,8 @@ import { ref, watch } from 'vue'
import useDebounce from '@/hooks/useDebounce' import useDebounce from '@/hooks/useDebounce'
import SearchModal from './search-modal.vue' import SearchModal from './search-modal.vue'
const emit = defineEmits(['focus', 'blur'])
const options = [ const options = [
{ {
label: '选项1', label: '选项1',
...@@ -84,7 +88,6 @@ const removeResult = () => { ...@@ -84,7 +88,6 @@ const removeResult = () => {
resultData.value = {} resultData.value = {}
} }
const handleSearch = useDebounce(function () { const handleSearch = useDebounce(function () {
if (!searchKey.value) return
isLoading.value = true isLoading.value = true
setTimeout(() => { setTimeout(() => {
resultData.value = { resultData.value = {
...@@ -103,6 +106,10 @@ const handleSearch = useDebounce(function () { ...@@ -103,6 +106,10 @@ const handleSearch = useDebounce(function () {
], ],
} }
isLoading.value = false isLoading.value = false
if (!searchKey.value) {
showResult.value = false
return
}
showResult.value = true showResult.value = true
}, 1000) }, 1000)
}) })
...@@ -110,7 +117,7 @@ watch( ...@@ -110,7 +117,7 @@ watch(
() => searchKey.value, () => searchKey.value,
(val) => { (val) => {
if (!val) { if (!val) {
setTimeout(() => removeResult(), 600) removeResult()
return return
} }
handleSearch() handleSearch()
......
<template> <template>
<NavBar /> <NavBar @focus="showTag = false" @blur="showTag = true" />
<BasicInfo /> <BasicInfo :visible="showTag" />
<div class="reset"> <div class="reset">
<img src="@images/reset.png" /> <img src="@images/reset.png" />
</div> </div>
...@@ -9,10 +9,12 @@ ...@@ -9,10 +9,12 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue'
import NavBar from './components/nav-bar.vue' import NavBar from './components/nav-bar.vue'
import BasicInfo from './components/basic-info.vue' import BasicInfo from './components/basic-info.vue'
import InforModal from './components/info-modal.vue' import InforModal from './components/info-modal.vue'
import listModal from './components/list-modal.vue' import listModal from './components/list-modal.vue'
const showTag = ref(true)
</script> </script>
<style lang="stylus"> <style lang="stylus">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment