From 1f7b564bd7635e61bebbf561c0c8294b11915c93 Mon Sep 17 00:00:00 2001 From: zydemail <1054055589@qq.com> Date: Mon, 22 Dec 2025 20:39:29 +0800 Subject: [PATCH 01/14] =?UTF-8?q?feat(chat):=20=E6=B7=BB=E5=8A=A0skyline?= =?UTF-8?q?=E6=B8=B2=E6=9F=93=E6=94=AF=E6=8C=81=E5=8F=8A=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attachments/_example/attachments.json | 1 + .../attachments/_example/attachments.less | 10 +++ .../attachments/_example/attachments.wxml | 42 +++++---- .../chat-content/_example/chat-content.json | 1 + .../chat-content/_example/chat-content.less | 10 +++ .../chat-content/_example/chat-content.wxml | 20 +++-- .../chat/chat-list/chat-list.wxml | 1 + .../chat-markdown/_example/chat-markdown.json | 1 + .../chat-markdown/_example/chat-markdown.less | 11 +++ .../chat-markdown/_example/chat-markdown.wxml | 54 +++++------ .../chat-message/_example/chat-message.json | 1 + .../chat-message/_example/chat-message.less | 11 +++ .../chat-message/_example/chat-message.wxml | 54 +++++------ .../chat-sender/_example/chat-sender.json | 1 + .../chat-sender/_example/chat-sender.less | 11 +++ .../chat-sender/_example/chat-sender.wxml | 42 +++++---- .../chat-thinking/_example/chat-thinking.json | 1 + .../chat-thinking/_example/chat-thinking.less | 10 +++ .../chat-thinking/_example/chat-thinking.wxml | 35 ++++---- packages/tdesign-miniprogram/example/app.json | 89 +++++++++++++++---- 20 files changed, 277 insertions(+), 129 deletions(-) diff --git a/packages/pro-components/chat/attachments/_example/attachments.json b/packages/pro-components/chat/attachments/_example/attachments.json index c8df4ffe9..b886d7832 100644 --- a/packages/pro-components/chat/attachments/_example/attachments.json +++ b/packages/pro-components/chat/attachments/_example/attachments.json @@ -1,5 +1,6 @@ { "navigationBarTitleText": "Attachments 聊天附件", + "disableScroll": true, "usingComponents": { "base": "./base", "fileLoading": "./file-loading", diff --git a/packages/pro-components/chat/attachments/_example/attachments.less b/packages/pro-components/chat/attachments/_example/attachments.less index e69de29bb..2d7f838b4 100644 --- a/packages/pro-components/chat/attachments/_example/attachments.less +++ b/packages/pro-components/chat/attachments/_example/attachments.less @@ -0,0 +1,10 @@ +.skyline { + display: flex; + flex-direction: column; + height: 100vh; + + .scroll-view { + flex: 1; + height: 0; + } +} diff --git a/packages/pro-components/chat/attachments/_example/attachments.wxml b/packages/pro-components/chat/attachments/_example/attachments.wxml index b09a7e2cb..850c8d501 100644 --- a/packages/pro-components/chat/attachments/_example/attachments.wxml +++ b/packages/pro-components/chat/attachments/_example/attachments.wxml @@ -1,20 +1,24 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/packages/pro-components/chat/chat-content/_example/chat-content.json b/packages/pro-components/chat/chat-content/_example/chat-content.json index 25ff5b753..a18591687 100644 --- a/packages/pro-components/chat/chat-content/_example/chat-content.json +++ b/packages/pro-components/chat/chat-content/_example/chat-content.json @@ -1,5 +1,6 @@ { "navigationBarTitleText": "ChatContent", + "disableScroll": true, "usingComponents": { "base": "./base" } diff --git a/packages/pro-components/chat/chat-content/_example/chat-content.less b/packages/pro-components/chat/chat-content/_example/chat-content.less index e69de29bb..2d7f838b4 100644 --- a/packages/pro-components/chat/chat-content/_example/chat-content.less +++ b/packages/pro-components/chat/chat-content/_example/chat-content.less @@ -0,0 +1,10 @@ +.skyline { + display: flex; + flex-direction: column; + height: 100vh; + + .scroll-view { + flex: 1; + height: 0; + } +} diff --git a/packages/pro-components/chat/chat-content/_example/chat-content.wxml b/packages/pro-components/chat/chat-content/_example/chat-content.wxml index 2d63cc958..c761e7106 100644 --- a/packages/pro-components/chat/chat-content/_example/chat-content.wxml +++ b/packages/pro-components/chat/chat-content/_example/chat-content.wxml @@ -1,7 +1,15 @@ - - - - - - + + + + + + + + + + diff --git a/packages/pro-components/chat/chat-list/chat-list.wxml b/packages/pro-components/chat/chat-list/chat-list.wxml index 4d595befb..4308bdbda 100644 --- a/packages/pro-components/chat/chat-list/chat-list.wxml +++ b/packages/pro-components/chat/chat-list/chat-list.wxml @@ -12,6 +12,7 @@ bindscroll="onScroll" bindscrolltoupper="handlerScrollToUpper" bindscrolltolower="handlerScrollToLower" + type="list" > diff --git a/packages/pro-components/chat/chat-markdown/_example/chat-markdown.json b/packages/pro-components/chat/chat-markdown/_example/chat-markdown.json index 9ee8ba68a..d2c3485aa 100644 --- a/packages/pro-components/chat/chat-markdown/_example/chat-markdown.json +++ b/packages/pro-components/chat/chat-markdown/_example/chat-markdown.json @@ -1,5 +1,6 @@ { "navigationBarTitleText": "ChatMarkdown 聊天 Markdown 渲染器", + "disableScroll": true, "usingComponents": { "base": "./base", "list": "./list", diff --git a/packages/pro-components/chat/chat-markdown/_example/chat-markdown.less b/packages/pro-components/chat/chat-markdown/_example/chat-markdown.less index 98bc646f9..2f765ac1a 100644 --- a/packages/pro-components/chat/chat-markdown/_example/chat-markdown.less +++ b/packages/pro-components/chat/chat-markdown/_example/chat-markdown.less @@ -15,3 +15,14 @@ .demo-block__content { min-height: 200rpx; } + +.skyline { + display: flex; + flex-direction: column; + height: 100vh; + + .scroll-view { + flex: 1; + height: 0; + } +} diff --git a/packages/pro-components/chat/chat-markdown/_example/chat-markdown.wxml b/packages/pro-components/chat/chat-markdown/_example/chat-markdown.wxml index 96a5a9b94..f224c05e5 100644 --- a/packages/pro-components/chat/chat-markdown/_example/chat-markdown.wxml +++ b/packages/pro-components/chat/chat-markdown/_example/chat-markdown.wxml @@ -1,26 +1,30 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/pro-components/chat/chat-message/_example/chat-message.json b/packages/pro-components/chat/chat-message/_example/chat-message.json index cec314a9b..0e5a4ed0a 100644 --- a/packages/pro-components/chat/chat-message/_example/chat-message.json +++ b/packages/pro-components/chat/chat-message/_example/chat-message.json @@ -1,5 +1,6 @@ { "navigationBarTitleText": "ChatItem", + "disableScroll": true, "usingComponents": { "t-skeleton": "tdesign-miniprogram/skeleton/skeleton", "base": "./base", diff --git a/packages/pro-components/chat/chat-message/_example/chat-message.less b/packages/pro-components/chat/chat-message/_example/chat-message.less index 191f5946d..213f45bfd 100644 --- a/packages/pro-components/chat/chat-message/_example/chat-message.less +++ b/packages/pro-components/chat/chat-message/_example/chat-message.less @@ -5,3 +5,14 @@ .t-button:last-child { margin-right: 0; } + +.skyline { + display: flex; + flex-direction: column; + height: 100vh; + + .scroll-view { + flex: 1; + height: 0; + } +} diff --git a/packages/pro-components/chat/chat-message/_example/chat-message.wxml b/packages/pro-components/chat/chat-message/_example/chat-message.wxml index b42ab7051..7fd6195e9 100644 --- a/packages/pro-components/chat/chat-message/_example/chat-message.wxml +++ b/packages/pro-components/chat/chat-message/_example/chat-message.wxml @@ -1,26 +1,30 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/pro-components/chat/chat-sender/_example/chat-sender.json b/packages/pro-components/chat/chat-sender/_example/chat-sender.json index 374658b37..024f123a8 100644 --- a/packages/pro-components/chat/chat-sender/_example/chat-sender.json +++ b/packages/pro-components/chat/chat-sender/_example/chat-sender.json @@ -1,5 +1,6 @@ { "navigationBarTitleText": "ChatSender", + "disableScroll": true, "usingComponents": { "t-tabs": "tdesign-miniprogram/tabs/tabs", "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel", diff --git a/packages/pro-components/chat/chat-sender/_example/chat-sender.less b/packages/pro-components/chat/chat-sender/_example/chat-sender.less index 4bafd7529..579d9764a 100644 --- a/packages/pro-components/chat/chat-sender/_example/chat-sender.less +++ b/packages/pro-components/chat/chat-sender/_example/chat-sender.less @@ -16,3 +16,14 @@ margin-right: 0; } +.skyline { + display: flex; + flex-direction: column; + height: 100vh; + + .scroll-view { + flex: 1; + height: 0; + } +} + diff --git a/packages/pro-components/chat/chat-sender/_example/chat-sender.wxml b/packages/pro-components/chat/chat-sender/_example/chat-sender.wxml index 19738427a..5b135cfe3 100644 --- a/packages/pro-components/chat/chat-sender/_example/chat-sender.wxml +++ b/packages/pro-components/chat/chat-sender/_example/chat-sender.wxml @@ -1,20 +1,24 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/packages/pro-components/chat/chat-thinking/_example/chat-thinking.json b/packages/pro-components/chat/chat-thinking/_example/chat-thinking.json index 884005a2b..d76ad6dfb 100644 --- a/packages/pro-components/chat/chat-thinking/_example/chat-thinking.json +++ b/packages/pro-components/chat/chat-thinking/_example/chat-thinking.json @@ -1,5 +1,6 @@ { "navigationBarTitleText": "ChatThinking 聊天思考状态", + "disableScroll": true, "usingComponents": { "base": "./base", "layout": "./layout", diff --git a/packages/pro-components/chat/chat-thinking/_example/chat-thinking.less b/packages/pro-components/chat/chat-thinking/_example/chat-thinking.less index e69de29bb..2d7f838b4 100644 --- a/packages/pro-components/chat/chat-thinking/_example/chat-thinking.less +++ b/packages/pro-components/chat/chat-thinking/_example/chat-thinking.less @@ -0,0 +1,10 @@ +.skyline { + display: flex; + flex-direction: column; + height: 100vh; + + .scroll-view { + flex: 1; + height: 0; + } +} diff --git a/packages/pro-components/chat/chat-thinking/_example/chat-thinking.wxml b/packages/pro-components/chat/chat-thinking/_example/chat-thinking.wxml index 56c058365..dbba717f8 100644 --- a/packages/pro-components/chat/chat-thinking/_example/chat-thinking.wxml +++ b/packages/pro-components/chat/chat-thinking/_example/chat-thinking.wxml @@ -1,17 +1,20 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/packages/tdesign-miniprogram/example/app.json b/packages/tdesign-miniprogram/example/app.json index 3445ff2d5..168905781 100644 --- a/packages/tdesign-miniprogram/example/app.json +++ b/packages/tdesign-miniprogram/example/app.json @@ -98,79 +98,127 @@ "subpackages": [ { "root": "pages/chat-list/", - "pages": ["chat-list"] + "pages": [ + "chat-list" + ] }, { "root": "pages/chat-content/", - "pages": ["chat-content"] + "pages": [ + "chat-content" + ] }, { "root": "pages/chat-actionbar/", - "pages": ["chat-actionbar"] + "pages": [ + "chat-actionbar" + ] }, { "root": "pages/chat-loading/", - "pages": ["chat-loading"] + "pages": [ + "chat-loading" + ] }, { "root": "pages/chat-thinking/", - "pages": ["chat-thinking"] + "pages": [ + "chat-thinking" + ] }, { "root": "pages/attachments/", - "pages": ["attachments"] + "pages": [ + "attachments" + ] }, { "root": "pages/chat-markdown/", - "pages": ["chat-markdown"] + "pages": [ + "chat-markdown" + ] }, { "root": "pages/chat-sender/", - "pages": ["chat-sender"] + "pages": [ + "chat-sender" + ] }, { "root": "pages/side-bar/", - "pages": ["side-bar", "base/index", "switch/index", "custom/index", "with-icon/index"] + "pages": [ + "side-bar", + "base/index", + "switch/index", + "custom/index", + "with-icon/index" + ] }, { "root": "pages/action-sheet/", - "pages": ["action-sheet"] + "pages": [ + "action-sheet" + ] }, { "root": "pages/avatar/", - "pages": ["avatar", "skyline/avatar"] + "pages": [ + "avatar", + "skyline/avatar" + ] }, { "root": "pages/calendar/", - "pages": ["calendar"] + "pages": [ + "calendar" + ] }, { "root": "pages/dialog/", - "pages": ["dialog", "skyline/dialog"] + "pages": [ + "dialog", + "skyline/dialog" + ] }, { "root": "pages/picker/", - "pages": ["picker", "skyline/picker"] + "pages": [ + "picker", + "skyline/picker" + ] }, { "root": "pages/rate/", - "pages": ["rate"] + "pages": [ + "rate" + ] }, { "root": "pages/swiper/", - "pages": ["swiper", "skyline/swiper"] + "pages": [ + "swiper", + "skyline/swiper" + ] }, { "root": "pages/swipe-cell/", - "pages": ["swipe-cell"] + "pages": [ + "swipe-cell" + ] }, { "root": "pages/tree-select/", - "pages": ["tree-select"] + "pages": [ + "tree-select" + ] }, { "root": "pages/indexes/", - "pages": ["indexes", "base/index", "custom/index"] + "pages": [ + "indexes", + "base/index", + "custom/index" + ] } ], "themeLocation": "theme.json", @@ -191,6 +239,9 @@ }, "sitemapLocation": "sitemap.json", "lazyCodeLoading": "requiredComponents", + "renderer": "skyline", + "componentFramework": "glass-easel", + "disableScroll": true, "rendererOptions": { "skyline": { "disableABTest": true, From e1698d94e07121cf520f02abf230220e69293b1d Mon Sep 17 00:00:00 2001 From: "seerzhang@tencent.com" <1016217659@qq.com> Date: Thu, 25 Dec 2025 20:30:14 +0800 Subject: [PATCH 02/14] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0chat-sender?= =?UTF-8?q?=E5=AF=B9skyline=E6=B8=B2=E6=9F=93=E6=A8=A1=E5=BC=8F=E7=9A=84?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_example/attachments/index.wxml | 2 +- .../chat/chat-sender/_example/base/index.wxss | 1 + .../_example/content-citation/index.wxml | 4 +-- .../_example/content-citation/index.wxss | 1 + .../_example/file-citation/index.wxml | 2 +- .../chat/chat-sender/chat-sender.less | 2 ++ .../chat/chat-sender/chat-sender.ts | 27 +++++++++++++++++-- .../chat/chat-sender/chat-sender.wxml | 4 ++- 8 files changed, 36 insertions(+), 7 deletions(-) diff --git a/packages/pro-components/chat/chat-sender/_example/attachments/index.wxml b/packages/pro-components/chat/chat-sender/_example/attachments/index.wxml index 6b5f70cb3..30c76ba46 100644 --- a/packages/pro-components/chat/chat-sender/_example/attachments/index.wxml +++ b/packages/pro-components/chat/chat-sender/_example/attachments/index.wxml @@ -1,5 +1,5 @@ - + diff --git a/packages/pro-components/chat/chat-sender/_example/base/index.wxss b/packages/pro-components/chat/chat-sender/_example/base/index.wxss index c04273942..3f21f2778 100644 --- a/packages/pro-components/chat/chat-sender/_example/base/index.wxss +++ b/packages/pro-components/chat/chat-sender/_example/base/index.wxss @@ -7,6 +7,7 @@ /* 聊天发送器包装器 */ .chat-sender-demo-wrapper { + height: 488rpx; margin-bottom: 32rpx; /* border: 2rpx solid #e5e5e5; */ border-radius: 8rpx; diff --git a/packages/pro-components/chat/chat-sender/_example/content-citation/index.wxml b/packages/pro-components/chat/chat-sender/_example/content-citation/index.wxml index 380ac3f68..85281a205 100644 --- a/packages/pro-components/chat/chat-sender/_example/content-citation/index.wxml +++ b/packages/pro-components/chat/chat-sender/_example/content-citation/index.wxml @@ -1,5 +1,5 @@ - + @@ -34,7 +34,7 @@ - {{headerText}} + {{headerText}} diff --git a/packages/pro-components/chat/chat-sender/_example/content-citation/index.wxss b/packages/pro-components/chat/chat-sender/_example/content-citation/index.wxss index 2d41e1bbb..d70a216ad 100644 --- a/packages/pro-components/chat/chat-sender/_example/content-citation/index.wxss +++ b/packages/pro-components/chat/chat-sender/_example/content-citation/index.wxss @@ -70,6 +70,7 @@ } .header-content { + flex: 1; padding: 2rpx 24rpx; box-sizing: border-box; white-space: nowrap; diff --git a/packages/pro-components/chat/chat-sender/_example/file-citation/index.wxml b/packages/pro-components/chat/chat-sender/_example/file-citation/index.wxml index 3874da7d8..0ce5489a4 100644 --- a/packages/pro-components/chat/chat-sender/_example/file-citation/index.wxml +++ b/packages/pro-components/chat/chat-sender/_example/file-citation/index.wxml @@ -1,5 +1,5 @@ - + diff --git a/packages/pro-components/chat/chat-sender/chat-sender.less b/packages/pro-components/chat/chat-sender/chat-sender.less index 445272129..e61e09337 100644 --- a/packages/pro-components/chat/chat-sender/chat-sender.less +++ b/packages/pro-components/chat/chat-sender/chat-sender.less @@ -26,6 +26,7 @@ @chat-sender-input-color: @text-color-primary; @chat-sender-input-caret-color: @brand-color; @chat-sender-input-letter-spacing: 5%; +@chat-sender-input-line-height: 48rpx; @chat-sender-placeholder-color: @text-color-disabled; @chat-sender-placeholder-transition: opacity 0.25s linear; @@ -111,6 +112,7 @@ caret-color: @chat-sender-input-caret-color; letter-spacing: @chat-sender-input-letter-spacing; padding-bottom: @chat-sender-textarea-hook-padding-bottom; + line-height: @chat-sender-input-line-height; } // 占位符 diff --git a/packages/pro-components/chat/chat-sender/chat-sender.ts b/packages/pro-components/chat/chat-sender/chat-sender.ts index 391be0457..5a1adc3be 100644 --- a/packages/pro-components/chat/chat-sender/chat-sender.ts +++ b/packages/pro-components/chat/chat-sender/chat-sender.ts @@ -43,6 +43,8 @@ export default class ChatSender extends SuperComponent { }, }, uploadNames: [], + textareaAutoHeight: true, // 动态控制 auto-height + currentLineCount: 1, // 当前行数 }; observers = { @@ -61,6 +63,20 @@ export default class ChatSender extends SuperComponent { }; methods = { + onLineChange(e) { + const { lineCount, height } = e.detail; + const maxHeight = this.data.textareaProps?.autosize?.maxHeight || 264; + + // 当高度达到或超过最大高度时,禁用 auto-height 并启用滚动 + // 当高度小于最大高度时,启用 auto-height + const shouldAutoHeight = height < maxHeight; + if (this.data.textareaAutoHeight !== shouldAutoHeight) { + this.setData({ textareaAutoHeight: shouldAutoHeight }); + } + + this.setData({ currentLineCount: lineCount }); + }, + onkeyboardheightchange(e) { // 业务侧控制键盘顶起高度,如果用fix布局,不需要监听键盘高度变化 this.triggerEvent('keyboardheightchange', e.detail); @@ -138,10 +154,17 @@ export default class ChatSender extends SuperComponent { }, textChange(e) { + const { value } = e.detail; this.setData({ - value: e.detail.value, + value, }); - this.triggerEvent('change', { value: e.detail.value, context: e }); + + // 当内容清空或变少时,重新启用 auto-height + if (!value || value.length === 0) { + this.setData({ textareaAutoHeight: true }); + } + + this.triggerEvent('change', { value, context: e }); }, handleUploadClick(e) { diff --git a/packages/pro-components/chat/chat-sender/chat-sender.wxml b/packages/pro-components/chat/chat-sender/chat-sender.wxml index 02c2bf628..68c15e5fc 100644 --- a/packages/pro-components/chat/chat-sender/chat-sender.wxml +++ b/packages/pro-components/chat/chat-sender/chat-sender.wxml @@ -34,7 +34,8 @@ class="{{classPrefix}}__textarea--control" style="{{_this.textareaStyle(textareaProps.autosize)}}" disabled="{{disabled}}" - auto-height="{{!!textareaProps.autosize}}" + auto-height="{{textareaAutoHeight}}" + show-scrollbar="{{!textareaAutoHeight}}" confirm-type="send" adjust-position="{{adjustPosition}}" disable-default-padding="{{false}}" @@ -46,6 +47,7 @@ bindblur="blurFn" bindtap="handlerClick" bindinput="textChange" + bindlinechange="onLineChange" bindkeyboardheightchange="onkeyboardheightchange" bindconfirm="handleSendClick" > From d06124da6e16f0faf45f9c48b56bb532908bcdaa Mon Sep 17 00:00:00 2001 From: CodeCarfter <43510057+zhangjiaoalice@users.noreply.github.com> Date: Fri, 26 Dec 2025 15:17:44 +0800 Subject: [PATCH 03/14] Feature/thinking skyline fix (#4143) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(chat-loading): chat-loading demo skyline style fixed * style: 修复chat-thinking组件demo moving 状态下的样式问题 --- .../chat/chat-loading/_example/base/index.wxss | 9 ++++++++- .../pro-components/chat/chat-loading/chat-loading.json | 2 +- .../pro-components/chat/chat-thinking/chat-thinking.less | 1 - 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/pro-components/chat/chat-loading/_example/base/index.wxss b/packages/pro-components/chat/chat-loading/_example/base/index.wxss index a75bd5351..e6a331f87 100644 --- a/packages/pro-components/chat/chat-loading/_example/base/index.wxss +++ b/packages/pro-components/chat/chat-loading/_example/base/index.wxss @@ -3,5 +3,12 @@ padding: 32rpx; display: flex; align-items: center; - gap: 48rpx; +} + +.chat-example-block { + margin-right: 48rpx; +} + +.chat-example-block:last-child { + margin-right: 0; } diff --git a/packages/pro-components/chat/chat-loading/chat-loading.json b/packages/pro-components/chat/chat-loading/chat-loading.json index 30294a659..31e617cd4 100644 --- a/packages/pro-components/chat/chat-loading/chat-loading.json +++ b/packages/pro-components/chat/chat-loading/chat-loading.json @@ -5,4 +5,4 @@ "t-skeleton": "tdesign-miniprogram/skeleton/skeleton", "t-loading": "tdesign-miniprogram/loading/loading" } -} +} \ No newline at end of file diff --git a/packages/pro-components/chat/chat-thinking/chat-thinking.less b/packages/pro-components/chat/chat-thinking/chat-thinking.less index 314f6b5ea..052a066b7 100644 --- a/packages/pro-components/chat/chat-thinking/chat-thinking.less +++ b/packages/pro-components/chat/chat-thinking/chat-thinking.less @@ -20,7 +20,6 @@ &__hd { height: 48rpx; - overflow: hidden; display: flex; align-items: center; From cf58b74bdc5a6841ac595ed00e6fbab5becf14ee Mon Sep 17 00:00:00 2001 From: nekowu <1142809915@qq.com> Date: Mon, 29 Dec 2025 11:35:31 +0800 Subject: [PATCH 04/14] =?UTF-8?q?fix:=20=E5=9B=BE=E7=89=87=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/attachments/attachments.less | 1 + .../chat/attachments/attachments.wxml | 4 ++-- .../chat/chat-list/_example/image/index.wxss | 14 +++++++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/pro-components/chat/attachments/attachments.less b/packages/pro-components/chat/attachments/attachments.less index 3ff937047..85b895c76 100644 --- a/packages/pro-components/chat/attachments/attachments.less +++ b/packages/pro-components/chat/attachments/attachments.less @@ -80,6 +80,7 @@ &__files { box-sizing: border-box; margin-left: @attachments-file-margin; + display: inline-flex; &:first-of-type { margin-left: 0; diff --git a/packages/pro-components/chat/attachments/attachments.wxml b/packages/pro-components/chat/attachments/attachments.wxml index 0769446fe..89c986eca 100644 --- a/packages/pro-components/chat/attachments/attachments.wxml +++ b/packages/pro-components/chat/attachments/attachments.wxml @@ -6,7 +6,7 @@ style="{{_._style([style, customStyle])}}" > - + @@ -70,6 +70,6 @@ - + diff --git a/packages/pro-components/chat/chat-list/_example/image/index.wxss b/packages/pro-components/chat/chat-list/_example/image/index.wxss index e31bbe356..58ce3d582 100644 --- a/packages/pro-components/chat/chat-list/_example/image/index.wxss +++ b/packages/pro-components/chat/chat-list/_example/image/index.wxss @@ -21,18 +21,22 @@ width: 100%; } +.image-chat .t-chat-message__detail { + width: 100%; +} + .attachment-slide { height: 274rpx; - width: 100%; + width: calc(100% + 128rpx) !important; } .attachment-slide .t-attachments { - padding-right: 32rpx; + height: 274rpx; padding-top: 24rpx; box-sizing: border-box; - position: fixed; + position: relative; z-index: 2; - left: 0; + left: -128rpx; right: 0; } @@ -41,5 +45,5 @@ } .attachment-slide .t-attachments .t-attachments__files:last-child { - padding-right: 32rpx; + padding-right: 64rpx; } From 7b29df535406b668d367f0108eb05dc21e344f31 Mon Sep 17 00:00:00 2001 From: nekowu <1142809915@qq.com> Date: Mon, 29 Dec 2025 11:53:01 +0800 Subject: [PATCH 05/14] =?UTF-8?q?fix:=20agent=E7=A4=BA=E4=BE=8B=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/chat-list/_example/agent/index.wxss | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/pro-components/chat/chat-list/_example/agent/index.wxss b/packages/pro-components/chat/chat-list/_example/agent/index.wxss index 8150545a5..225a4751d 100644 --- a/packages/pro-components/chat/chat-list/_example/agent/index.wxss +++ b/packages/pro-components/chat/chat-list/_example/agent/index.wxss @@ -54,11 +54,11 @@ } .t-steps-item__circle--finish { - background-color: transparent; - color: var(--td-text-color-primary); - border: 1px solid var(--td-text-color-primary); - width: 16px; - height: 16px; + background-color: transparent !important; + color: var(--td-text-color-primary) !important; + border: 1px solid var(--td-text-color-primary) !important; + width: 16px !important; + height: 16px !important; } .t-steps-item__circle--finish .t-icon { @@ -66,10 +66,10 @@ } .t-steps-item__line--finish { - background-color: var(--td-component-border); + background-color: var(--td-component-border) !important; } .t-steps-item__title--finish { - color: var(--td-text-color-primary); - font-weight: 600; + color: var(--td-text-color-primary) !important; + font-weight: 600 !important; } From 8e148c1e4864d08b60375402d6cf5ef2cd9b3328 Mon Sep 17 00:00:00 2001 From: nekowu <1142809915@qq.com> Date: Mon, 29 Dec 2025 17:32:43 +0800 Subject: [PATCH 06/14] =?UTF-8?q?fix:=20skyline=E6=A0=B7=E5=BC=8F=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/pro-components/chat/attachments/attachments.less | 2 +- .../pro-components/chat/chat-content/chat-content.less | 6 ++++-- .../chat/chat-markdown/_example/code/index.wxss | 4 ++++ .../pro-components/chat/chat-markdown/chat-markdown.less | 4 ++-- .../pro-components/chat/chat-message/chat-message.less | 7 ++----- .../pro-components/chat/chat-thinking/chat-thinking.less | 1 + 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/packages/pro-components/chat/attachments/attachments.less b/packages/pro-components/chat/attachments/attachments.less index 85b895c76..5afcfe5b8 100644 --- a/packages/pro-components/chat/attachments/attachments.less +++ b/packages/pro-components/chat/attachments/attachments.less @@ -80,7 +80,7 @@ &__files { box-sizing: border-box; margin-left: @attachments-file-margin; - display: inline-flex; + display: inline-block; &:first-of-type { margin-left: 0; diff --git a/packages/pro-components/chat/chat-content/chat-content.less b/packages/pro-components/chat/chat-content/chat-content.less index 00a16fa62..2de28041d 100644 --- a/packages/pro-components/chat/chat-content/chat-content.less +++ b/packages/pro-components/chat/chat-content/chat-content.less @@ -5,14 +5,16 @@ @chat-content-user-text-color: var(--td-chat-content-user-text-color, @text-color-primary); @chat-content-assistant-text-color: var(--td-chat-content-assistant-text-color, @text-color-primary); @chat-content-error-text-color: var(--td-chat-content-error-text-color, @error-color); +@chat-content-line-height: 1.5; .@{chat-content} { font: @font-body-large; + line-height: @chat-content-line-height; word-break: break-all; word-wrap: break-word; overflow-wrap: break-word; box-sizing: border-box; - width: fit-content; + max-width: 100%; &__user, &__system { @@ -42,7 +44,7 @@ border-radius: @radius-small; } } -// 错误状态样式 + // 错误状态样式 &__error { color: @chat-content-error-text-color; } diff --git a/packages/pro-components/chat/chat-markdown/_example/code/index.wxss b/packages/pro-components/chat/chat-markdown/_example/code/index.wxss index 700cf8b15..32cea8fad 100644 --- a/packages/pro-components/chat/chat-markdown/_example/code/index.wxss +++ b/packages/pro-components/chat/chat-markdown/_example/code/index.wxss @@ -2,3 +2,7 @@ background-color: var(--td-bg-color-container); padding: 32rpx; } + +.chat-example-block .t-chat-markdown-code__content { + height: 96rpx; +} diff --git a/packages/pro-components/chat/chat-markdown/chat-markdown.less b/packages/pro-components/chat/chat-markdown/chat-markdown.less index 9351a6ff3..8557683ff 100644 --- a/packages/pro-components/chat/chat-markdown/chat-markdown.less +++ b/packages/pro-components/chat/chat-markdown/chat-markdown.less @@ -4,7 +4,7 @@ @chat-markdown-table: ~'@{prefix}-chat-markdown-table'; @chat-markdown-color: @text-color-primary; -@chat-markdown-line-height: 1.75; +@chat-markdown-line-height: 1.5; @chat-markdown-h1: 2em; @chat-markdown-h2: 1.75em; @chat-markdown-h3: 1.5em; @@ -115,7 +115,7 @@ &-list { display: block; padding: 0; - margin: 0 0 @spacer 1.5em;; + margin: 0 0 @spacer 1.5em; // 有序列表 &__decimal { diff --git a/packages/pro-components/chat/chat-message/chat-message.less b/packages/pro-components/chat/chat-message/chat-message.less index ca1e6aa03..37345b70b 100644 --- a/packages/pro-components/chat/chat-message/chat-message.less +++ b/packages/pro-components/chat/chat-message/chat-message.less @@ -47,7 +47,8 @@ .@{chat-message}__detail { max-width: 100%; box-sizing: border-box; - display: contents; + display: flex; + flex-direction: column; } // 有头部时的样式 @@ -66,10 +67,6 @@ .@{chat-message}__base { padding-right: @spacer-2; } - - .@{chat-content} { - max-width: 90%; - } } // 助手消息样式 diff --git a/packages/pro-components/chat/chat-thinking/chat-thinking.less b/packages/pro-components/chat/chat-thinking/chat-thinking.less index 052a066b7..e60c6c647 100644 --- a/packages/pro-components/chat/chat-thinking/chat-thinking.less +++ b/packages/pro-components/chat/chat-thinking/chat-thinking.less @@ -4,6 +4,7 @@ .@{chat-thinking} { width: 100%; + max-width: 100%; box-sizing: border-box; &__inner { From 907dd09d411116bc095e158a1bfeadfb6a03765f Mon Sep 17 00:00:00 2001 From: waiterxiaoyy <738294518@qq.com> Date: Tue, 30 Dec 2025 14:25:09 +0800 Subject: [PATCH 07/14] =?UTF-8?q?fix:=20attachments=E5=9C=A8skyline?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E4=B8=8Bloading=E6=A0=B7=E5=BC=8F=E4=B8=BAsp?= =?UTF-8?q?inner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pro-components/chat/attachments/attachments.ts | 3 +++ .../pro-components/chat/attachments/attachments.wxml | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/pro-components/chat/attachments/attachments.ts b/packages/pro-components/chat/attachments/attachments.ts index 2c78d7785..6e10f2576 100644 --- a/packages/pro-components/chat/attachments/attachments.ts +++ b/packages/pro-components/chat/attachments/attachments.ts @@ -27,6 +27,7 @@ export default class Attachments extends SuperComponent { data = { classPrefix: name, files: [], + isSkyline: false, }; observers = { @@ -187,6 +188,8 @@ export default class Attachments extends SuperComponent { this.data.renderIcon = this.renderIcon.bind(this); this.data.renderFileType = this.renderFileType.bind(this); this.data.renderExtension = this.renderExtension.bind(this); + // 检测 Skyline 模式 + this.setData({ isSkyline: this.renderer === 'skyline' }); }, attached() { this.setFiles(); diff --git a/packages/pro-components/chat/attachments/attachments.wxml b/packages/pro-components/chat/attachments/attachments.wxml index 89c986eca..df68af3ae 100644 --- a/packages/pro-components/chat/attachments/attachments.wxml +++ b/packages/pro-components/chat/attachments/attachments.wxml @@ -6,14 +6,14 @@ style="{{_._style([style, customStyle])}}" > - + - + @@ -35,17 +35,17 @@ - + - + - + @@ -70,6 +70,6 @@ - + From f96aa926b54bb980175a62c0e8db3b840e64be24 Mon Sep 17 00:00:00 2001 From: nekowu <1142809915@qq.com> Date: Tue, 30 Dec 2025 14:47:55 +0800 Subject: [PATCH 08/14] =?UTF-8?q?feat:=20=E6=A8=AA=E5=90=91=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E8=AE=A1=E7=AE=97=E9=AB=98=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/attachments/attachments.less | 2 +- .../chat/attachments/attachments.ts | 30 +++++++++++++++++ .../chat/attachments/attachments.wxml | 3 +- .../chat/chat-list/_example/image/index.wxss | 1 - .../chat-markdown/_example/code/index.wxss | 4 --- .../chat-markdown-code.less | 2 +- .../chat-markdown-code/chat-markdown-code.ts | 32 +++++++++++++++++++ .../chat-markdown-code.wxml | 2 +- 8 files changed, 67 insertions(+), 9 deletions(-) diff --git a/packages/pro-components/chat/attachments/attachments.less b/packages/pro-components/chat/attachments/attachments.less index 5afcfe5b8..66ff8ce6c 100644 --- a/packages/pro-components/chat/attachments/attachments.less +++ b/packages/pro-components/chat/attachments/attachments.less @@ -23,7 +23,7 @@ // 可滚动内容区域 &__scrollable { - height: 100%; + /* 移除固定高度设置,由动态绑定控制高度 */ display: flex; align-items: center; justify-content: flex-start; diff --git a/packages/pro-components/chat/attachments/attachments.ts b/packages/pro-components/chat/attachments/attachments.ts index 6e10f2576..84cf41f93 100644 --- a/packages/pro-components/chat/attachments/attachments.ts +++ b/packages/pro-components/chat/attachments/attachments.ts @@ -28,11 +28,16 @@ export default class Attachments extends SuperComponent { classPrefix: name, files: [], isSkyline: false, + scrollViewHeight: 0, // 新增:scroll-view的高度 }; observers = { items() { this.setFiles(); + // 新增:文件列表变化时重新计算高度 + wx.nextTick(() => { + this.getScrollViewHeight(); + }); }, }; @@ -52,6 +57,13 @@ export default class Attachments extends SuperComponent { this.handleRemove(item, index); } }, + // 新增:图片加载完成回调 + onImageLoad() { + // 图片加载完成后重新计算高度 + wx.nextTick(() => { + this.getScrollViewHeight(); + }); + }, handleFileClick(item) { if (this.data.imageViewer && item.fileType === 'image') { wx.previewImage({ @@ -63,6 +75,20 @@ export default class Attachments extends SuperComponent { handleRemove(item, index) { this.triggerEvent('remove', { item, index }); }, + // 修改:获取所有文件元素的最大高度 + getScrollViewHeight() { + const query = this.createSelectorQuery(); + query.selectAll('.t-attachments__files').boundingClientRect(); + query.exec((res) => { + if (res[0] && res[0].length > 0) { + // 获取所有文件元素的最大高度 + const maxFileHeight = Math.max(...res[0].map((rect) => rect.height)); + this.setData({ + scrollViewHeight: maxFileHeight, + }); + } + }); + }, renderDesc(item) { const sizeInBytes = item.size || 0; let formattedSize; @@ -193,6 +219,10 @@ export default class Attachments extends SuperComponent { }, attached() { this.setFiles(); + // 新增:组件挂载时计算高度 + wx.nextTick(() => { + this.getScrollViewHeight(); + }); }, detached() {}, }; diff --git a/packages/pro-components/chat/attachments/attachments.wxml b/packages/pro-components/chat/attachments/attachments.wxml index df68af3ae..62dceffd5 100644 --- a/packages/pro-components/chat/attachments/attachments.wxml +++ b/packages/pro-components/chat/attachments/attachments.wxml @@ -6,7 +6,7 @@ style="{{_._style([style, customStyle])}}" > - + @@ -23,6 +23,7 @@ mode="{{_this.getImageMode(item)}}" lazy-load="false" style="{{inChat ? _this.imageStyle(item) : ''}}" + bindload="onImageLoad" > diff --git a/packages/pro-components/chat/chat-list/_example/image/index.wxss b/packages/pro-components/chat/chat-list/_example/image/index.wxss index 58ce3d582..d062eac78 100644 --- a/packages/pro-components/chat/chat-list/_example/image/index.wxss +++ b/packages/pro-components/chat/chat-list/_example/image/index.wxss @@ -31,7 +31,6 @@ } .attachment-slide .t-attachments { - height: 274rpx; padding-top: 24rpx; box-sizing: border-box; position: relative; diff --git a/packages/pro-components/chat/chat-markdown/_example/code/index.wxss b/packages/pro-components/chat/chat-markdown/_example/code/index.wxss index 32cea8fad..700cf8b15 100644 --- a/packages/pro-components/chat/chat-markdown/_example/code/index.wxss +++ b/packages/pro-components/chat/chat-markdown/_example/code/index.wxss @@ -2,7 +2,3 @@ background-color: var(--td-bg-color-container); padding: 32rpx; } - -.chat-example-block .t-chat-markdown-code__content { - height: 96rpx; -} diff --git a/packages/pro-components/chat/chat-markdown/chat-markdown-code/chat-markdown-code.less b/packages/pro-components/chat/chat-markdown/chat-markdown-code/chat-markdown-code.less index 9f0f999d1..7a0b02863 100644 --- a/packages/pro-components/chat/chat-markdown/chat-markdown-code/chat-markdown-code.less +++ b/packages/pro-components/chat/chat-markdown/chat-markdown-code/chat-markdown-code.less @@ -61,7 +61,7 @@ overflow-y: hidden; -webkit-overflow-scrolling: touch; white-space: nowrap; - height: auto; + /* 移除height: auto,由动态绑定控制高度 */ } // 代码文本 diff --git a/packages/pro-components/chat/chat-markdown/chat-markdown-code/chat-markdown-code.ts b/packages/pro-components/chat/chat-markdown/chat-markdown-code/chat-markdown-code.ts index 7c38b9caf..6b8dcf871 100644 --- a/packages/pro-components/chat/chat-markdown/chat-markdown-code/chat-markdown-code.ts +++ b/packages/pro-components/chat/chat-markdown/chat-markdown-code/chat-markdown-code.ts @@ -19,5 +19,37 @@ export default class ChatMarkdownCode extends SuperComponent { data = { classPrefix: name, + scrollViewHeight: 0, // 新增:scroll-view的高度 + }; + + methods = { + // 新增:获取text节点高度 + getTextNodeHeight() { + const query = this.createSelectorQuery(); + query.select('.t-chat-markdown-code__text').boundingClientRect(); + query.exec((res) => { + if (res[0]) { + const textHeight = res[0].height; + this.setData({ + scrollViewHeight: textHeight, + }); + } + }); + }, + }; + + // 新增:监听node属性变化,重新计算高度 + observers = { + 'node.text': function () { + wx.nextTick(() => { + this.getTextNodeHeight(); + }); + }, + }; + + lifetimes = { + attached() { + this.getTextNodeHeight(); + }, }; } diff --git a/packages/pro-components/chat/chat-markdown/chat-markdown-code/chat-markdown-code.wxml b/packages/pro-components/chat/chat-markdown/chat-markdown-code/chat-markdown-code.wxml index 3b39d6230..1ed8d8733 100644 --- a/packages/pro-components/chat/chat-markdown/chat-markdown-code/chat-markdown-code.wxml +++ b/packages/pro-components/chat/chat-markdown/chat-markdown-code/chat-markdown-code.wxml @@ -5,7 +5,7 @@ - + {{node.text}} From df72d7c62603ed0e9384f7cedbeefa38537f9601 Mon Sep 17 00:00:00 2001 From: nekowu <1142809915@qq.com> Date: Tue, 30 Dec 2025 14:54:00 +0800 Subject: [PATCH 09/14] =?UTF-8?q?feat:=20=E6=A8=AA=E5=90=91=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E8=AE=A1=E7=AE=97=E9=AB=98=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/pro-components/chat/attachments/attachments.wxml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pro-components/chat/attachments/attachments.wxml b/packages/pro-components/chat/attachments/attachments.wxml index 62dceffd5..e962013c9 100644 --- a/packages/pro-components/chat/attachments/attachments.wxml +++ b/packages/pro-components/chat/attachments/attachments.wxml @@ -71,6 +71,6 @@ - + From 0e4e8e575df7d0d41c470973761ac334713505b2 Mon Sep 17 00:00:00 2001 From: nekowu <1142809915@qq.com> Date: Tue, 30 Dec 2025 14:59:05 +0800 Subject: [PATCH 10/14] =?UTF-8?q?feat:=20=E6=A0=B7=E5=BC=8F=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pro-components/chat/chat-list/_example/image/index.wxss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pro-components/chat/chat-list/_example/image/index.wxss b/packages/pro-components/chat/chat-list/_example/image/index.wxss index d062eac78..09852ba34 100644 --- a/packages/pro-components/chat/chat-list/_example/image/index.wxss +++ b/packages/pro-components/chat/chat-list/_example/image/index.wxss @@ -21,7 +21,7 @@ width: 100%; } -.image-chat .t-chat-message__detail { +.image-chat .assistant .t-chat-message__detail { width: 100%; } From 81ed772a299247694251cde71c60b4bfc37380ae Mon Sep 17 00:00:00 2001 From: anlyyao Date: Tue, 30 Dec 2025 20:28:30 +0800 Subject: [PATCH 11/14] chore(ChatList): support skyline render --- .../chat/chat-list/chat-list.less | 14 +-- .../chat/chat-list/chat-list.wxml | 5 +- packages/tdesign-miniprogram/example/app.json | 89 +++++-------------- 3 files changed, 32 insertions(+), 76 deletions(-) diff --git a/packages/pro-components/chat/chat-list/chat-list.less b/packages/pro-components/chat/chat-list/chat-list.less index 5f9c896f1..0d59661ab 100644 --- a/packages/pro-components/chat/chat-list/chat-list.less +++ b/packages/pro-components/chat/chat-list/chat-list.less @@ -12,7 +12,6 @@ color: @chat-text-color; &__content { - flex: 1; overflow-y: auto; overflow-x: hidden; width: 100%; @@ -26,10 +25,15 @@ transform: scaleY(-1); } } + } - .placeholder { - flex-grow: 1; - flex-shrink: 1; - } + &__placeholder { + flex-grow: 1; + flex-shrink: 1; + } + + &__footer { + flex-grow: 0; + flex-shrink: 0; } } diff --git a/packages/pro-components/chat/chat-list/chat-list.wxml b/packages/pro-components/chat/chat-list/chat-list.wxml index 4308bdbda..7b0513b5a 100644 --- a/packages/pro-components/chat/chat-list/chat-list.wxml +++ b/packages/pro-components/chat/chat-list/chat-list.wxml @@ -14,9 +14,6 @@ bindscrolltolower="handlerScrollToLower" type="list" > - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{item.name}} - - 上传中...{{item.progress || 0+"%"}} - 上传失败 - {{item.errorMessage}} - {{item.desc}} - - - - - - - - - - + + + + + + +