增加搜索页面

This commit is contained in:
xuli3099
2025-08-04 16:19:03 +08:00
parent 9542db8bad
commit da67a1bf5d
5 changed files with 265 additions and 69 deletions

View File

@@ -8,13 +8,13 @@
<!-- 高度来避免头部遮挡 -->
<view class="top-height"></view>
<!-- 搜索 -->
<!-- 搜索 @confirm="handleSearch" -->
<view class="search">
<uni-search-bar class="custom-search" radius="28"
placeholder="请输入您想查询的内容或服务"
clearButton="auto" cancelButton="none"
bgColor="#6FA2F8" textColor="#ffffff"
@confirm="handleSearch"
@focus="handleFocus"
/>
</view>
@@ -91,6 +91,11 @@ let handleExpand = (item)=>{
item.expandFlag = !item.expandFlag;
}
// 获取input 焦点跳转
let handleFocus=()=>{
uni.navigateTo({url:'/pages/search/search?type=2'})
}
// 查询搜索跳转
let handleSearch = ()=>{

View File

@@ -9,13 +9,13 @@
<!-- #ifdef H5 -->
<view style="height:50rpx"></view>
<!-- #endif -->
<!-- 搜索 -->
<!-- 搜索 @confirm="handleSearch" -->
<view class="search search-sao" >
<uni-search-bar class="custom-search" radius="28"
placeholder="请输入您想查询的内容或服务"
clearButton="auto" cancelButton="none"
bgColor="#6FA2F8" textColor="#ffffff"
@confirm="handleSearch"
@focus="handleFocus"
/>
<uni-icons custom-prefix="iconfont" color="#ffffff" type="icon-phonesaoyisao" size="20"></uni-icons>
</view>
@@ -188,6 +188,11 @@ const navBarPaddingTop = ref(0);
onMounted(() => {
navBarPaddingTop.value = getNavBarPaddingTop()*2;
})
// 获取input 焦点跳转
let handleFocus=()=>{
uni.navigateTo({url:'/pages/search/search?type=1'})
}
// 查询搜索跳转
let handleSearch = ()=>{

View File

@@ -14,9 +14,10 @@
<!-- 搜索 -->
<view class="search">
<!-- @confirm="handleSearch" -->
<uni-search-bar class="custom-search" radius="28" placeholder="请输入您想查询的内容或服务" clearButton="auto"
cancelButton="none" bgColor="#6FA2F8" textColor="#ffffff"
@confirm="handleSearch" @focus="handleFocus"
@focus="handleFocus"
/>
</view>
@@ -54,7 +55,7 @@ onMounted(() => {
// 获取input 焦点跳转
let handleFocus=()=>{
uni.navigateTo({url:'/pages/search/search'})
uni.navigateTo({url:'/pages/search/search?type=3'})
}
// 查询搜索跳转

View File

@@ -8,15 +8,22 @@
<!-- 高度来避免头部遮挡 -->
<view class="top-height"></view>
<customSearch></customSearch>
<customSearch :type="type"></customSearch>
</view>
</view>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { ref, onMounted } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import customHeader from '@/components/customHeader.vue'
import customSearch from '@/components/customSearch.vue'
let type=ref(1);
onLoad(async(opt) => {
console.log(opt.type)
type.value = opt.type;
})
</script>
<style scoped>