27 lines
805 B
Plaintext
27 lines
805 B
Plaintext
<template>
|
|
<input type="text" placeholder="请输入搜索内容" @keydown.enter="keyDown" v-model="search"
|
|
class="h-full w-full text-#fff text-18px pl30px pr54px placeholder-#fff" />
|
|
<img src="@/assets/images/icon-search.svg" @click="clickThis" class="w22px h22px absolute right-24px top-50% -translate-y-50%" />
|
|
</template>
|
|
<script setup lang="ts">
|
|
|
|
import { searchStore } from '@/stores/modules/search'
|
|
const searchS = searchStore()
|
|
const search = ref('')
|
|
const { push } = useRouter()
|
|
const keyDown=(e)=>{
|
|
if(e.key ==='Enter'&&search.value)
|
|
{
|
|
searchS.search.content = search.value
|
|
push({name:'Search'})
|
|
}
|
|
}
|
|
const clickThis = ()=>{
|
|
if(search.value)
|
|
{
|
|
searchS.search.content = search.value
|
|
push({name:'Search'})
|
|
}
|
|
}
|
|
|
|
</script> |