修改搜索显示

master
于肖磊 2026-02-26 15:54:56 +08:00
parent e4c9a6077c
commit ddfd93ec1d
2 changed files with 21 additions and 8 deletions

View File

@ -350,9 +350,6 @@
params: app.globalData.launch_params_handle(params),
});
},
onShow() {
this.init();
},
onHide() {
//
if (this.video_switch_debounce_timer) {
@ -365,6 +362,7 @@
this.cleanup_all_videos();
},
mounted() {
this.init();
// #ifdef H5
//
document.addEventListener('click', this.handle_global_click);
@ -422,10 +420,10 @@
this.setData({
header_padding_left: padding_left,
menu_button_info: menu_button_info,
current_video_id: this.params.id,
current_video_id: isEmpty(this.current_video_id) ? this.params.id : this.current_video_id,
});
this.get_video_detail(this.params.id);
this.get_video_detail(this.current_video_id);
},
//
get_video_detail(id) {
@ -544,7 +542,9 @@
this.display_video_list.forEach((item, index) => {
this.create_video_contexts[index] = uni.createVideoContext(`video_${index}`, this);
//#ifdef H5
this.video_contexts[index] = document.getElementById(`video_${index}`).querySelector('video');
if (document.getElementById(`video_${index}`) != null) {
this.video_contexts[index] = document.getElementById(`video_${index}`).querySelector('video');
}
//#endif
});
@ -1095,7 +1095,9 @@
const data = res.data;
if (data.code == 0) {
const new_data = data.data;
if (new_data.data.length > 0) {
if (comment.page == 0) {
comment.sub_comments = new_data.data;
} else if (new_data.data.length > 0) {
comment.sub_comments.push(...new_data.data);
}
comment.page = new_data.page;

View File

@ -17,6 +17,10 @@
</view>
<!-- 搜索历史记录 -->
<view v-if="show_search_history.length > 0" class="search-history flex-col jc-c align-c">
<view class="wh-auto flex-row align-c jc-sb">
<text class="size-16 cr-6">历史记录</text>
<text class="size-16 cr-6" @tap="clear_history"></text>
</view>
<view v-for="(history, index) in show_search_history" :key="index" class="wh-auto history-item flex-row align-c jc-sb">
<view class="flex-row align-c search-history-title cp" :data-value="history" @tap.stop="perform_search">
<iconfont name="icon-time" size="32rpx"></iconfont>
@ -25,7 +29,7 @@
<iconfont name="icon-close-line" size="24rpx" :data-index="index" @tap="delete_history"></iconfont>
</view>
<!-- 查看更多 -->
<template v-if="search_history.length > (show_search_history.length + 4)">
<template v-if="search_history.length > show_search_history.length">
<template v-if="is_view_more">
<loadingComponent></loadingComponent>
</template>
@ -226,6 +230,13 @@ export default {
this.setData({
hot_current_tab: e.currentTarget.dataset.index,
});
},
clear_history() {
uni.setStorageSync('search_history_key', []);
this.setData({
search_history: [],
show_search_history: [],
});
}
}
};