修复日记长文输入布局并减少输入时正文回传

This commit is contained in:
2026-10-11 09:22:29 +08:00
parent 5365e13963
commit 1bafb01741
7 changed files with 25 additions and 8 deletions
+3 -1
View File
@@ -259,7 +259,9 @@ Page({
onDateInput: function(e) { this.setData({ 'form.date': e.detail.value }); this._saveDraft(); },
onContentInput: function(e){
var val = e.detail.value || '';
this.setData({ 'form.content': val, contentLength: val.length });
// 正文只存于逻辑层,避免每次敲字回传长文本影响原生输入。
this.data.form.content = val;
this.setData({ contentLength: val.length });
this._saveDraft();
},
onLocationInput: function(e){ this.setData({ 'form.location': e.detail.value }); this._saveDraft(); },
+1 -1
View File
@@ -101,7 +101,7 @@
<label>内容</label>
<text class="char-count {{contentLength > 5000 ? 'char-warn' : ''}}">{{contentLength}}/5000</text>
</view>
<textarea placeholder-class="handwritten-placeholder" class="input textarea diary-editor" placeholder="今天发生了什么有趣的事呢?写下你的心情和感受吧…" value="{{editorContent}}" bindinput="onContentInput" maxlength="{{5000}}" auto-height="{{false}}" cursor-spacing="24" />
<textarea placeholder-class="handwritten-placeholder" class="input textarea diary-editor" placeholder="今天发生了什么有趣的事呢?写下你的心情和感受吧…" value="{{editorContent}}" bindinput="onContentInput" maxlength="5000" auto-height="{{true}}" cursor-spacing="24" />
</view>
<!-- 图片选择(可删除) -->
+2 -2
View File
@@ -207,8 +207,8 @@ page { background: linear-gradient(180deg, #FDE4EC 0%, #FFF0F5 48%, #FFF7FA 100%
@import '../../styles/journal.wxss';
/* 长正文在输入框内滚动,避免输入时整页不断增高。 */
textarea.diary-editor { height:420rpx; min-height:420rpx; box-sizing:border-box; }
/* 正文随输入增高,长文由外层页面滚动,避免嵌套原生输入框滚动。 */
textarea.diary-editor { min-height:420rpx; box-sizing:border-box; }
@import '../../styles/button-theme.wxss';