更新代码

This commit is contained in:
duan 2025-01-06 17:55:26 +08:00
parent 4ec188968d
commit caea0aeb6c
2 changed files with 75 additions and 13 deletions

View File

@ -44,7 +44,7 @@
"path" : "pages/index/search/index",
"style" :
{
"navigationBarTitleText" : ""
"navigationBarTitleText" : "搜索"
}
}
],

View File

@ -1,22 +1,84 @@
<template>
<view>
<u-sticky :enable="true">
<view class="search-box">
<u-search bg-color="#f2f2f2" style="width: 100%;" placeholder="搜索更多资源" :focus="true" :show-action="true"
:animation="true" action-text="取消" @custom="goBack()" @search="doSearch(false)"></u-search>
</view>
</u-sticky>
</view>
<view class="search-keyword">
<view class="keyword-block" v-if="datas.hotKeywordList.length !=0">
<view class="keyword-list-header">
<view>热搜</view>
</view>
<view class="keyword" v-if="forbid==''">
<view v-for="(keyword,index) in datas.hotKeywordList" @tap="doSearchs(keyword)" :key="index"
v-if="keyword">
{{keyword}}
</view>
</view>
<view class="hide-hot-tis" v-else>
<view>当前搜热已隐藏</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
<script setup>
import {
reactive
} from 'vue';
import {
onShow
} from '@dcloudio/uni-app'
let datas = reactive({
hotKeywordList: [], //
})
onShow(() => {
getList()
})
function getList() {
if (uni.getStorageSync('moreSearch')) {
datas.hotKeywordList = (uni.getStorageSync('moreSearch')).split(',')
} else {
datas.hotKeywordList = []
}
}
</script>
<style>
<style scoped lang="scss">
.search-box {
width: 100%;
/* background-color: rgb(242, 242, 242); */
padding: 15upx 2.5%;
display: flex;
justify-content: space-between;
// position: sticky;
// top: 0;
background-color: #ffffff;
}
</style>
.search-keyword {
width: 100%;
}
.keyword-block {
padding: 10upx 0;
}
.keyword-block .keyword-list-header {
width: 94%;
padding: 10upx 3%;
font-size: 27upx;
color: #333;
display: flex;
justify-content: space-between;
}
.keyword-block .keyword-list-header image {
width: 40upx;
height: 40upx;
}
</style>