Skip to content

Commit f9f1d47

Browse files
committed
输入法高度调整
1 parent c71d3d2 commit f9f1d47

File tree

1 file changed

+24
-51
lines changed

1 file changed

+24
-51
lines changed

src/components/chat/InputPanel.vue

Lines changed: 24 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,6 @@ const sendTextMessage = () => {
7575
messageText.value = ''
7676
// 重置状态
7777
isTyping.value = false
78-
79-
// 重置输入框高度
80-
nextTick(() => {
81-
if (messageInput.value) {
82-
messageInput.value.style.height = 'auto'
83-
}
84-
})
8578
}
8679
8780
// 保存消息到历史记录
@@ -147,8 +140,8 @@ const handleInput = () => {
147140
const autoResizeTextarea = () => {
148141
if (!messageInput.value) return
149142
150-
messageInput.value.style.height = 'auto'
151-
messageInput.value.style.height = `${Math.min(messageInput.value.scrollHeight, 120)}px`
143+
// 不再调整高度,只处理输入事件
144+
// 高度已固定,只需确保滚动条正常工作
152145
}
153146
154147
// 处理按键事件
@@ -411,7 +404,7 @@ onUnmounted(() => {
411404
position: relative;
412405
background-color: var(--ios-bg-primary);
413406
border-top: 1px solid var(--ios-border-color);
414-
padding: 8px 12px;
407+
padding: 10px 12px;
415408
display: flex;
416409
flex-direction: column;
417410
box-sizing: border-box;
@@ -420,7 +413,7 @@ onUnmounted(() => {
420413
/* 表情包和图标工具栏 */
421414
.icons-toolbar {
422415
width: 100%;
423-
margin-bottom: 8px;
416+
margin-bottom: 10px;
424417
}
425418
426419
.icons-group {
@@ -466,37 +459,17 @@ onUnmounted(() => {
466459
position: relative;
467460
}
468461
469-
.input-container::after {
470-
content: "可拖动调整高度";
471-
position: absolute;
472-
right: 8px;
473-
bottom: 4px;
474-
font-size: 10px;
475-
color: var(--ios-text-tertiary);
476-
opacity: 0.6;
477-
pointer-events: none;
478-
transition: opacity 0.3s ease;
479-
background-color: rgba(255, 255, 255, 0.7);
480-
padding: 1px 3px;
481-
border-radius: 3px;
482-
}
483-
484-
.input-container:hover::after {
485-
opacity: 1;
486-
}
487-
488462
.message-input {
489463
width: 100%;
490-
min-height: 36px;
491-
max-height: 120px;
492-
padding: 8px 12px 18px 12px;
464+
height: 120px;
465+
padding: 12px 15px;
493466
border-radius: 18px;
494467
background-color: var(--ios-bg-tertiary);
495468
border: 1px solid var(--ios-border-color);
496469
outline: none;
497-
resize: vertical;
498-
font-size: 14px;
499-
line-height: 1.4;
470+
resize: none;
471+
font-size: 15px;
472+
line-height: 1.5;
500473
color: var(--ios-text-primary);
501474
overflow-y: auto;
502475
transition: all 0.2s ease;
@@ -528,9 +501,9 @@ onUnmounted(() => {
528501
}
529502
530503
.send-button {
531-
width: 36px;
532-
height: 36px;
533-
min-width: 36px;
504+
width: 40px;
505+
height: 40px;
506+
min-width: 40px;
534507
border-radius: 50%;
535508
display: flex;
536509
align-items: center;
@@ -543,7 +516,7 @@ onUnmounted(() => {
543516
opacity: 0.5;
544517
pointer-events: none;
545518
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
546-
margin-bottom: 1px;
519+
margin-bottom: 10px;
547520
}
548521
549522
.send-button.active {
@@ -559,7 +532,7 @@ onUnmounted(() => {
559532
/* 表情选择器 */
560533
.emoji-picker {
561534
position: absolute;
562-
top: 46px;
535+
top: 50px;
563536
left: 12px;
564537
background-color: var(--ios-bg-primary);
565538
border-radius: 12px;
@@ -617,7 +590,7 @@ onUnmounted(() => {
617590
/* 历史记录面板 */
618591
.history-panel {
619592
position: absolute;
620-
top: 46px;
593+
top: 50px;
621594
left: 50px;
622595
background-color: var(--ios-bg-primary);
623596
border-radius: 12px;
@@ -727,11 +700,11 @@ onUnmounted(() => {
727700
/* 响应式适配 */
728701
@media screen and (max-width: 768px) {
729702
.chat-input-panel {
730-
padding: 6px 10px;
703+
padding: 8px 10px;
731704
}
732705
733706
.icons-toolbar {
734-
margin-bottom: 6px;
707+
margin-bottom: 8px;
735708
}
736709
737710
.icons-group {
@@ -753,16 +726,16 @@ onUnmounted(() => {
753726
}
754727
755728
.message-input {
756-
min-height: 34px;
757-
max-height: 100px;
758-
padding: 7px 10px 16px 10px;
729+
height: 50px;
730+
padding: 10px 12px;
759731
font-size: 14px;
760732
}
761733
762734
.send-button {
763-
width: 34px;
764-
height: 34px;
765-
min-width: 34px;
735+
width: 36px;
736+
height: 36px;
737+
min-width: 36px;
738+
margin-bottom: 7px;
766739
}
767740
768741
.send-button svg {
@@ -788,7 +761,7 @@ onUnmounted(() => {
788761
789762
.emoji-picker,
790763
.history-panel {
791-
top: 42px;
764+
top: 45px;
792765
max-height: 240px;
793766
}
794767
}

0 commit comments

Comments
 (0)