使输入框失去焦点

master
于肖磊 2026-03-13 15:10:23 +08:00
parent 3ce6f61448
commit ddfb967c72
2 changed files with 15 additions and 4 deletions

View File

@ -4,7 +4,12 @@
<view class="search-iconfont-container"> <view class="search-iconfont-container">
<u-icon propName="search-fine"></u-icon> <u-icon propName="search-fine"></u-icon>
</view> </view>
<input class="flex-1" type="text" v-model="search_keywords" :adjust-position="false" :placeholder="$t('search.search.ic9b89')" @input="handle_search" @confirm="perform_search" /> <!-- #ifndef APP-NVUE-->
<input class="flex-1" type="text" v-model="search_keywords" :adjust-position="false" placeholder-style="font-size:28rpx" :placeholder="$t('search.search.ic9b89')" @input="handle_search" @confirm="perform_search" />
<!-- #endif-->
<!-- #ifdef APP-NVUE-->
<input class="flex-1" type="text" v-model="search_keywords" :adjust-position="false" placeholder-style="font-size:14px" :placeholder="$t('search.search.ic9b89')" @input="handle_search" @confirm="perform_search" />
<!-- #endif-->
<view class="search-line"></view> <view class="search-line"></view>
<text class="search-button" @tap="perform_search">{{$t('common.search')}}</text> <text class="search-button" @tap="perform_search">{{$t('common.search')}}</text>
</view> </view>

View File

@ -225,7 +225,7 @@
</view> </view>
</view> </view>
<view class="flex-row align-c wh-auto ht-auto pr-16 box-border-box" :style="window_more_style"> <view class="flex-row align-c wh-auto ht-auto pr-16 box-border-box" :style="window_more_style">
<input :value="comment_input_value" :focus="is_add_comment" class="comment-input" style="margin-right: 20rpx;" type="text" confirm-type="send" :adjust-position="false" :auto-blur="true" :placeholder="input_placeholder" @input="comment_input_event" @blur="() => is_add_comment = false" @confirm="send_comment" /> <input ref="commentRef" :value="comment_input_value" :focus="is_add_comment" class="comment-input" style="margin-right: 20rpx;" type="text" confirm-type="send" :adjust-position="false" :auto-blur="true" :placeholder="input_placeholder" @input="comment_input_event" @blur="() => is_add_comment = false" @confirm="send_comment" />
<component-upload :propMaxNum="propMaxNum" :propPathType="editor_path_type" propSlot propSingleCall propIsAllInfo @call-back="upload_images_event"> <component-upload :propMaxNum="propMaxNum" :propPathType="editor_path_type" propSlot propSingleCall propIsAllInfo @call-back="upload_images_event">
<u-icon propName="layout-module-single-images" propSize="48rpx" propColor="#999"></u-icon> <u-icon propName="layout-module-single-images" propSize="48rpx" propColor="#999"></u-icon>
</component-upload> </component-upload>
@ -875,7 +875,8 @@
}, },
// 关闭评论区 // 关闭评论区
close_comment_modal(e) { close_comment_modal(e) {
try { try {
this.active_dropdown_id = null; this.active_dropdown_id = null;
this.show_comment_modal = false; this.show_comment_modal = false;
this.comment_scroll_top = 0 + Math.random(); // 关闭评论时滚动到最顶部 this.comment_scroll_top = 0 + Math.random(); // 关闭评论时滚动到最顶部
@ -891,6 +892,10 @@
if (this.comment_move_throttle_timer) { if (this.comment_move_throttle_timer) {
clearTimeout(this.comment_move_throttle_timer); clearTimeout(this.comment_move_throttle_timer);
this.comment_move_throttle_timer = null; this.comment_move_throttle_timer = null;
}
if (this.$refs.commentRef) {
this.$refs.commentRef.blur();
} }
} catch (error) { } catch (error) {
console.error('close_comment_modal error:', error); console.error('close_comment_modal error:', error);
@ -1305,7 +1310,7 @@
}, },
// 删除回复评论数据 // 删除回复评论数据
comment_data_delete() { comment_data_delete() {
try { try {
this.active_dropdown_id = null; this.active_dropdown_id = null;
this.comments_reply_data = {}; this.comments_reply_data = {};
} catch (error) { } catch (error) {
@ -1654,6 +1659,7 @@
add_comment() { add_comment() {
try { try {
//#ifndef H5 //#ifndef H5
this.active_dropdown_id = null;
this.is_add_comment = true; this.is_add_comment = true;
this.active_dropdown_id = null; this.active_dropdown_id = null;
//#endif //#endif