增加搜索

This commit is contained in:
xuli3099
2025-08-01 18:47:31 +08:00
parent 540f513e82
commit 9542db8bad
3 changed files with 38 additions and 1 deletions

View File

@@ -126,6 +126,12 @@
"style": { "style": {
"navigationBarTitleText": "" "navigationBarTitleText": ""
} }
},
{
"path": "pages/search/search",
"style": {
"navigationBarTitleText": ""
}
} }
], ],
"globalStyle": { "globalStyle": {

View File

@@ -15,7 +15,9 @@
<!-- 搜索 --> <!-- 搜索 -->
<view class="search"> <view class="search">
<uni-search-bar class="custom-search" radius="28" placeholder="请输入您想查询的内容或服务" clearButton="auto" <uni-search-bar class="custom-search" radius="28" placeholder="请输入您想查询的内容或服务" clearButton="auto"
cancelButton="none" bgColor="#6FA2F8" textColor="#ffffff" @confirm="handleSearch" /> cancelButton="none" bgColor="#6FA2F8" textColor="#ffffff"
@confirm="handleSearch" @focus="handleFocus"
/>
</view> </view>
<!-- 消息列表 --> <!-- 消息列表 -->
@@ -50,6 +52,11 @@ onMounted(() => {
navBarPaddingTop.value = getNavBarPaddingTop() * 2; navBarPaddingTop.value = getNavBarPaddingTop() * 2;
}) })
// 获取input 焦点跳转
let handleFocus=()=>{
uni.navigateTo({url:'/pages/search/search'})
}
// 查询搜索跳转 // 查询搜索跳转
let handleSearch = () => { let handleSearch = () => {

View File

@@ -0,0 +1,24 @@
<template>
<view class="con-body">
<view class="con-bg">
<!-- 头部 -->
<customHeader ref="customHeaderRef" :title="'搜索'"
:leftFlag="true" :rightFlag="false"
></customHeader>
<!-- 高度来避免头部遮挡 -->
<view class="top-height"></view>
<customSearch></customSearch>
</view>
</view>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import customHeader from '@/components/customHeader.vue'
import customSearch from '@/components/customSearch.vue'
</script>
<style scoped>
</style>