Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5811753
feat(chat): 添加skyline渲染支持及滚动优化
zydemail Dec 22, 2025
dcb6615
feat: 增加chat-sender对skyline渲染模式的支持
goldjunkrat Dec 25, 2025
0cd7982
Feature/thinking skyline fix (#4143)
zhangjiaoalice Dec 26, 2025
14b2ab5
fix: 图片示例样式调整
mimaoxiao Dec 29, 2025
6bff515
fix: agent示例样式调整
mimaoxiao Dec 29, 2025
98ec922
fix: skyline样式调整
mimaoxiao Dec 29, 2025
504034f
fix: attachments在skyline模式下loading样式为spinner
waiterxiaoyy Dec 30, 2025
2284d80
feat: 横向滚动计算高度
mimaoxiao Dec 30, 2025
4475296
feat: 横向滚动计算高度
mimaoxiao Dec 30, 2025
9d707ca
feat: 样式调整
mimaoxiao Dec 30, 2025
1f7b564
feat(chat): 添加skyline渲染支持及滚动优化
zydemail Dec 22, 2025
e1698d9
feat: 增加chat-sender对skyline渲染模式的支持
goldjunkrat Dec 25, 2025
d06124d
Feature/thinking skyline fix (#4143)
zhangjiaoalice Dec 26, 2025
cf58b74
fix: 图片示例样式调整
mimaoxiao Dec 29, 2025
7b29df5
fix: agent示例样式调整
mimaoxiao Dec 29, 2025
8e148c1
fix: skyline样式调整
mimaoxiao Dec 29, 2025
907dd09
fix: attachments在skyline模式下loading样式为spinner
waiterxiaoyy Dec 30, 2025
f96aa92
feat: 横向滚动计算高度
mimaoxiao Dec 30, 2025
df72d7c
feat: 横向滚动计算高度
mimaoxiao Dec 30, 2025
0e4e8e5
feat: 样式调整
mimaoxiao Dec 30, 2025
81ed772
chore(ChatList): support skyline render
anlyyao Dec 30, 2025
8c2e411
fix: 移除分享按钮边框
zydemail Dec 31, 2025
29a5844
fix: 对话里的图片是横向,附件是纵向
zydemail Dec 31, 2025
201435a
fix: 去掉组件源码里的isSkyline
zydemail Dec 31, 2025
a59258a
Merge branch 'feature/chat-skyline' of https://github.com/Tencent/tde…
mimaoxiao Dec 31, 2025
c4006fb
feat: 根据 isSkyline 动态切换加载动画主题
zydemail Dec 31, 2025
3c0fb26
Merge branch 'feature/chat-skyline' of https://github.com/Tencent/tde…
mimaoxiao Jan 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions packages/components/common/style/theme/_font.less
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,32 @@ page,
--td-font-link-small: var(--td-font-size-link-small) / var(--td-line-height-link-small) var(--td-font-family);
--td-font-link-medium: var(--td-font-size-link-medium) / var(--td-line-height-link-medium) var(--td-font-family);
--td-font-link-large: var(--td-font-size-link-large) / var(--td-line-height-link-large) var(--td-font-family);
--td-font-mark-extraSmall: 600 var(--td-font-size-mark-extraSmall) / var(--td-line-height-mark-extraSmall) var(--td-font-family);
--td-font-mark-extraSmall: 600 var(--td-font-size-mark-extraSmall) / var(--td-line-height-mark-extraSmall)
var(--td-font-family);
--td-font-mark-small: 600 var(--td-font-size-mark-small) / var(--td-line-height-mark-small) var(--td-font-family);
--td-font-mark-medium: 600 var(--td-font-size-mark-medium) / var(--td-line-height-mark-medium) var(--td-font-family);
--td-font-mark-large: 600 var(--td-font-size-mark-large) / var(--td-line-height-mark-large) var(--td-font-family);
--td-font-body-extraSmall: var(--td-font-size-body-extraSmall) / var(--td-line-height-body-extraSmall) var(--td-font-family);
--td-font-body-extraSmall: var(--td-font-size-body-extraSmall) / var(--td-line-height-body-extraSmall)
var(--td-font-family);
--td-font-body-small: var(--td-font-size-body-small) / var(--td-line-height-body-small) var(--td-font-family);
--td-font-body-medium: var(--td-font-size-body-medium) / var(--td-line-height-body-medium) var(--td-font-family);
--td-font-body-large: var(--td-font-size-body-large) / var(--td-line-height-body-large) var(--td-font-family);
--td-font-title-small: 600 var(--td-font-size-title-small) / var(--td-line-height-title-small) var(--td-font-family);
--td-font-title-medium: 600 var(--td-font-size-title-medium) / var(--td-line-height-title-medium) var(--td-font-family);
--td-font-title-medium: 600 var(--td-font-size-title-medium) / var(--td-line-height-title-medium)
var(--td-font-family);
--td-font-title-large: 600 var(--td-font-size-title-large) / var(--td-line-height-title-large) var(--td-font-family);
--td-font-title-extraLarge: 600 var(--td-font-size-title-extraLarge) / var(--td-line-height-title-extraLarge) var(--td-font-family);
--td-font-headline-small: 600 var(--td-font-size-headline-small) / var(--td-line-height-headline-small) var(--td-font-family);
--td-font-headline-medium: 600 var(--td-font-size-headline-medium) / var(--td-line-height-headline-medium) var(--td-font-family);
--td-font-headline-large: 600 var(--td-font-size-headline-large) / var(--td-line-height-headline-large) var(--td-font-family);
--td-font-display-medium: 600 var(--td-font-size-display-medium) / var(--td-line-height-display-medium) var(--td-font-family);
--td-font-display-large: 600 var(--td-font-size-display-large) / var(--td-line-height-display-large) var(--td-font-family);
--td-font-title-extraLarge: 600 var(--td-font-size-title-extraLarge) / var(--td-line-height-title-extraLarge)
var(--td-font-family);
--td-font-headline-small: 600 var(--td-font-size-headline-small) / var(--td-line-height-headline-small)
var(--td-font-family);
--td-font-headline-medium: 600 var(--td-font-size-headline-medium) / var(--td-line-height-headline-medium)
var(--td-font-family);
--td-font-headline-large: 600 var(--td-font-size-headline-large) / var(--td-line-height-headline-large)
var(--td-font-family);
--td-font-display-medium: 600 var(--td-font-size-display-medium) / var(--td-line-height-display-medium)
var(--td-font-family);
--td-font-display-large: 600 var(--td-font-size-display-large) / var(--td-line-height-display-large)
var(--td-font-family);

// 字体大小 token
--td-font-size: 20rpx;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"navigationBarTitleText": "Attachments 聊天附件",
"disableScroll": true,
"usingComponents": {
"base": "./base",
"fileLoading": "./file-loading",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.skyline {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

与全局样式文件内容重复,可移除

display: flex;
flex-direction: column;
height: 100vh;

.scroll-view {
flex: 1;
height: 0;
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
<t-navbar class="demo-navbar" title="Attachments" leftArrow placeholder />
<view class="demo">
<t-demo-header
title="Attachments 文件附件"
desc="用于聊天场景中上传、预览和管理附件的组件。"
notice="渲染框架支持情况:WebView"
/>
<t-demo title="01 组件类型" desc="图片类型">
<base />
</t-demo>
<t-demo desc="文件类型">
<file />
</t-demo>
<t-demo title="02 组件状态" desc="图片类型加载状态">
<imageLoading />
</t-demo>
<t-demo desc="文件类型加载状态">
<fileLoading />
</t-demo>
<view class="skyline">
<t-navbar class="demo-navbar" title="Attachments" leftArrow placeholder />
<scroll-view scroll-y type="list" class="scroll-view">
<view class="demo">
<t-demo-header
title="Attachments 文件附件"
desc="用于聊天场景中上传、预览和管理附件的组件。"
notice="渲染框架支持情况:WebView"
/>
<t-demo title="01 组件类型" desc="图片类型">
<base />
</t-demo>
<t-demo desc="文件类型">
<file />
</t-demo>
<t-demo title="02 组件状态" desc="图片类型加载状态">
<imageLoading />
</t-demo>
<t-demo desc="文件类型加载状态">
<fileLoading />
</t-demo>
</view>
</scroll-view>
</view>
3 changes: 2 additions & 1 deletion packages/pro-components/chat/attachments/attachments.less
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

// 可滚动内容区域
&__scrollable {
height: 100%;
/* 移除固定高度设置,由动态绑定控制高度 */
display: flex;
align-items: center;
justify-content: flex-start;
Expand Down Expand Up @@ -80,6 +80,7 @@
&__files {
box-sizing: border-box;
margin-left: @attachments-file-margin;
display: inline-block;

&:first-of-type {
margin-left: 0;
Expand Down
33 changes: 33 additions & 0 deletions packages/pro-components/chat/attachments/attachments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@ export default class Attachments extends SuperComponent {
data = {
classPrefix: name,
files: [],
isSkyline: false,
scrollViewHeight: 0, // 新增:scroll-view的高度
};

observers = {
items() {
this.setFiles();
// 新增:文件列表变化时重新计算高度
wx.nextTick(() => {
this.getScrollViewHeight();
});
},
};

Expand All @@ -51,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({
Expand All @@ -62,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;
Expand Down Expand Up @@ -187,9 +214,15 @@ 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();
// 新增:组件挂载时计算高度
wx.nextTick(() => {
this.getScrollViewHeight();
});
},
detached() {},
};
Expand Down
176 changes: 111 additions & 65 deletions packages/pro-components/chat/attachments/attachments.wxml
Original file line number Diff line number Diff line change
@@ -1,75 +1,121 @@
<wxs src="./attachments.wxs" module="_this" />
<wxs src="../../../components/common/utils.wxs" module="_" />

<!-- 图片文件模板 -->
<template name="image-item">
<view class="file-image {{classPrefix}}__file {{removable ? classPrefix + '__file--removable' : ''}}">
<block wx:if="{{item.status==='pending' || item.status==='fail' || item.status==='error'}}">
<view class="{{item.status}} {{classPrefix}}__file--{{item.status}}">
<t-loading theme="{{isSkyline ? 'spinner' : 'circular'}}" size="48rpx" />
</view>
</block>
<block wx:else>
<image
class="image"
src="{{item.url}}"
mode="{{_this.getImageMode(item)}}"
lazy-load="false"
style="{{inChat ? _this.imageStyle(item) : ''}}"
bindload="onImageLoad"
></image>
</block>
<view wx:if="{{removable}}" class="{{classPrefix}}__remove">
<t-icon data-index="{{index}}" name="multiply" size="16px" catchtap="onRemoveTap" />
</view>
</view>
</template>

<!-- 普通文件模板 -->
<template name="file-item">
<view class="file {{classPrefix}}__file {{removable ? classPrefix + '__file--removable' : ''}}">
<view class="image">
<block wx:if="{{item.status==='pending'}}">
<view class="loading {{classPrefix}}__file--pending">
<t-loading theme="{{isSkyline ? 'spinner' : 'circular'}}" size="48rpx" />
</view>
</block>
<block wx:elif="{{item.status==='fail'}}">
<view class="fail {{classPrefix}}__file--fail">
<t-loading theme="{{isSkyline ? 'spinner' : 'circular'}}" size="48rpx" />
</view>
</block>
<block wx:elif="{{item.status==='error'}}">
<view class="error {{classPrefix}}__file--error">
<t-loading theme="{{isSkyline ? 'spinner' : 'circular'}}" size="48rpx" />
</view>
</block>
<block wx:else>
<t-icon name="{{item.fileIcon.name}}" color="{{item.fileIcon.color}}" size="48rpx"></t-icon>
</block>
</view>
<view class="{{classPrefix}}__content">
<view class="{{classPrefix}}__title">{{item.name}}</view>
<view wx:if="{{item.status==='pending'}}" class="{{classPrefix}}__desc">上传中...{{item.progress || 0+"%"}}</view>
<view wx:elif="{{item.status==='fail'}}" class="{{classPrefix}}__desc">上传失败</view>
<view wx:elif="{{item.status==='error'}}" class="{{classPrefix}}__desc">{{item.errorMessage}}</view>
<view wx:else class="{{classPrefix}}__desc">{{item.desc}}</view>
</view>
<view wx:if="{{removable}}" class="{{classPrefix}}__remove">
<t-icon data-index="{{index}}" name="multiply" size="16px" catchtap="onRemoveTap" />
</view>
</view>
</template>

<view
class="{{classPrefix}} {{[inChat ? classPrefix + '--chatting' : '', _this.getFileTypeClass(inChat, files)]}}"
style="{{_._style([style, customStyle])}}"
>
<view class="{{classPrefix}}__left">
<view class="{{classPrefix}}__scrollable scroll-x">
<block wx:for="{{files}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<view class="{{classPrefix}}__files" bindtap="onFileWrapTap" data-index="{{index}}">
<block wx:if="{{item.fileType==='image'}}">
<view class="file-image {{classPrefix}}__file {{removable ? classPrefix + '__file--removable' : ''}}">
<block wx:if="{{item.status==='pending' || item.status==='fail' || item.status==='error'}}">
<view class="{{item.status}} {{classPrefix}}__file--{{item.status}}">
<t-loading theme="circular" size="48rpx" />
</view>
</block>
<block wx:else>
<image
class="image"
src="{{item.url}}"
mode="{{_this.getImageMode(item)}}"
lazy-load="false"
style="{{inChat ? _this.imageStyle(item) : ''}}"
></image>
</block>
<view wx:if="{{removable}}" class="{{classPrefix}}__remove">
<t-icon data-index="{{index}}" name="multiply" size="16px" catchtap="onRemoveTap" />
</view>
</view>
</block>
<block wx:else>
<view class="file {{classPrefix}}__file {{removable ? classPrefix + '__file--removable' : ''}}">
<view class="image">
<block wx:if="{{item.status==='pending'}}">
<view class="loading {{classPrefix}}__file--pending">
<t-loading theme="circular" size="48rpx" />
</view>
</block>
<block wx:elif="{{item.status==='fail'}}">
<view class="fail {{classPrefix}}__file--fail">
<t-loading theme="circular" size="48rpx" />
</view>
</block>
<block wx:elif="{{item.status==='error'}}">
<view class="error {{classPrefix}}__file--error">
<t-loading theme="circular" size="48rpx" />
</view>
</block>
<block wx:else>
<t-icon name="{{item.fileIcon.name}}" color="{{item.fileIcon.color}}" size="48rpx"></t-icon>
</block>
</view>
<view class="{{classPrefix}}__content">
<view class="{{classPrefix}}__title">{{item.name}}</view>
<block>
<view wx:if="{{item.status==='pending'}}" class="{{classPrefix}}__desc"
>上传中...{{item.progress || 0+"%"}}</view
>
<view wx:elif="{{item.status==='fail'}}" class="{{classPrefix}}__desc">上传失败</view>
<view wx:elif="{{item.status==='error'}}" class="{{classPrefix}}__desc">{{item.errorMessage}}</view>
<view wx:else class="{{classPrefix}}__desc">{{item.desc}}</view>
</block>
</view>
<view wx:if="{{removable}}" class="{{classPrefix}}__remove">
<t-icon data-index="{{index}}" name="multiply" size="16px" catchtap="onRemoveTap" />
</view>
</view>
</block>
</view>
</block>
</view>
<!-- 对话模式:图片横向滚动,文件纵向排列 -->
<block wx:if="{{inChat}}">
<!-- 图片横向滚动区域 -->
<scroll-view
wx:if="{{_this.hasImageFile(files)}}"
class="{{classPrefix}}__scrollable scroll-x"
scroll-x
style="height: {{scrollViewHeight}}px"
>
<block wx:for="{{files}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<view
wx:if="{{item.fileType==='image'}}"
class="{{classPrefix}}__files"
bindtap="onFileWrapTap"
data-index="{{index}}"
>
<template is="image-item" data="{{item, index, classPrefix, removable, inChat}}" />
</view>
</block>
</scroll-view>

<!-- 非图片文件纵向排列 -->
<view class="{{classPrefix}}__files-container">
<block wx:for="{{files}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<view
wx:if="{{item.fileType!=='image'}}"
class="{{classPrefix}}__files"
bindtap="onFileWrapTap"
data-index="{{index}}"
>
<template is="file-item" data="{{item, index, classPrefix, removable}}" />
</view>
</block>
</view>
</block>

<!-- 非对话模式:所有文件横向滚动 -->
<block wx:else>
<scroll-view class="{{classPrefix}}__scrollable scroll-x" scroll-x style="height: {{scrollViewHeight}}px">
<block wx:for="{{files}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<view class="{{classPrefix}}__files" bindtap="onFileWrapTap" data-index="{{index}}">
<template
wx:if="{{item.fileType==='image'}}"
is="image-item"
data="{{item, index, classPrefix, removable, inChat}}"
/>
<template wx:else is="file-item" data="{{item, index, classPrefix, removable}}" />
</view>
</block>
</scroll-view>
</block>
</view>
</view>
Loading
Loading