Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 19 additions & 0 deletions .github/workflows/pr-compressed-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,22 @@ jobs:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
install-script: 'npm install --force'
pattern: './packages/tdesign-miniprogram/miniprogram_dist/**/*.{js,wxs,wxml,json}'
comment-key: miniprogram

- name: Install pnpm
run: npm install -g pnpm@9

- name: Install dependencies
run: pnpm install

- uses: preactjs/compressed-size-action@v2
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
pattern: './packages/tdesign-uniapp/npm_dist/**/*.{js,ts,vue,less,css}'
comment-key: uniapp

- uses: preactjs/compressed-size-action@v2
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
pattern: './packages/tdesign-uniapp-chat/npm_dist/**/*.{js,ts,vue,less,css}'
comment-key: uniapp-chat
10 changes: 9 additions & 1 deletion .github/workflows/typos-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,12 @@ nd = "nd"
loosing = "loosing"

[files]
extend-exclude = ["CHANGELOG*.md", "changelog.json", "echarts.js"]
extend-exclude = [
"CHANGELOG*.md",
"changelog.json",
"echarts.js",
"packages/tdesign-uniapp/components/npm/**/*",
"packages/tdesign-uniapp-chat/components/npm/**/*",
"packages/tdesign-uniapp/app/common/uni.css",
"packages/tdesign-uniapp/app/uni_modules/**/*",
]
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ _wechatide
_example
!packages/components/**/_example/
!packages/pro-components/**/_example/
!packages/tdesign-uniapp/**/_example/
!packages/tdesign-uniapp-chat/**/_example/

packages/tdesign-miniprogram/example/pages/*
!packages/tdesign-miniprogram/example/pages/gulp-error
Expand All @@ -14,6 +16,22 @@ packages/tdesign-miniprogram/test/e2e
packages/tdesign-miniprogram/test/unit
packages/tdesign-miniprogram/test/unit-virtualHost

# about uniapp
packages/tdesign-uniapp/example/src/_tdesign
packages/tdesign-uniapp/example/src/_tdesign-raw/
packages/tdesign-uniapp/example/src/pages-more/
packages/tdesign-uniapp/npm_dist/
packages/tdesign-uniapp-chat/npm_dist/

# about app of uniapp
packages/tdesign-uniapp/app/uni_modules/tdesign-uniapp*/
packages/tdesign-uniapp/app/unpackage/
packages/tdesign-uniapp/app/pages-more/
packages/tdesign-uniapp/app/pages/
packages/tdesign-uniapp/app/components/
packages/tdesign-uniapp/app/tdesign-uniapp-raw/


.DS_Store
node_modules
package-lock.json
Expand Down
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,10 @@
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"cSpell.words": ["stylelint", "cascader"]
"cSpell.words": [
"stylelint",
"cascader",
"tdesign",
"uniapp",
]
}
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"scripts": {
"start": "npm run dev",
"dev": "cross-env NODE_ENV=development gulp dev --gulpfile script/gulpfile.js --cwd ./",
"uniapp": "pnpm -C packages/tdesign-uniapp",
"uniapp:chat": "pnpm -C packages/tdesign-uniapp-chat",
"build": "cross-env NODE_ENV=production gulp build --gulpfile script/gulpfile.js --cwd ./",
"build:dist": "gulp --gulpfile script/gulpfile.dist.js --cwd ./",
"build:example": "gulp --gulpfile script/gulpfile.example.js --cwd ./",
Expand Down Expand Up @@ -40,7 +42,9 @@
"generate": "gulp generate --gulpfile script/gulpfile.js --cwd ./",
"changelog": "node script/generate-changelog.js",
"robot": "publish-cli robot-msg",
"qrcode": "pnpm -C packages/tdesign-miniprogram/site qrcode"
"qrcode": "pnpm -C packages/tdesign-miniprogram/site qrcode",
"build:uniapp": "pnpm -C packages/tdesign-uniapp run release:prepare",
"build:uniapp:chat": "pnpm -C packages/tdesign-uniapp run release:prepare"
},
"author": "tdesign",
"license": "MIT",
Expand Down
17 changes: 17 additions & 0 deletions packages/tdesign-uniapp-chat/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
unpackage
node_modules/
coverage
static/common/*

dist/
/log/
!.vuepress

uni_modules/
miniprogram_npm/
packages/tdesign/npm/
packages/tdesign-uniapp-chat/npm/
packages/tdesign-uniapp-chat/chat-list/_example/ec-canvas/echarts.js

*.html
!.stylelintrc.js
24 changes: 24 additions & 0 deletions packages/tdesign-uniapp-chat/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
root: true,
extends: ['eslint-config-light-vue3'],
globals: {
getCurrentPages: true,
uni: true,
globalThis: true,
qq: true,
weex: true,
plus: true,
getApp: true,
},
parserOptions: {
project: 'tsconfig.eslint.json',
// https://stackoverflow.com/questions/77792745/fatalerror-error-ts6046-argument-for-moduleresolution-option-must-be-nod
tsconfigRootDir: __dirname,

ecmaVersion: 'latest',
extraFileExtensions: ['.vue'],
},
rules: {
'vue/no-v-text-v-html-on-component': 0,
},
};
1 change: 1 addition & 0 deletions packages/tdesign-uniapp-chat/components/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://registry.npmjs.org/
11 changes: 11 additions & 0 deletions packages/tdesign-uniapp-chat/components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: 更新日志
spline: explain
toc: false
docClass: timeline
---

## 🌈 0.1.1 `2025-11-17`
### 🐞 Bug Fixes
- `Attachments`: 修复图标点击事件冒泡问题 @novlan1 ([#72](https://github.com/novlan1/tdesign-uniapp/pull/72))

9 changes: 9 additions & 0 deletions packages/tdesign-uniapp-chat/components/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2021-present TDesign

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
108 changes: 108 additions & 0 deletions packages/tdesign-uniapp-chat/components/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@

<p align="center">
<a href="https://tdesign.tencent.com/" target="_blank">
<img alt="TDesign Logo" width="200" src="https://tdesign.gtimg.com/site/TDesign.png">
</a>
</p>

<p align="center">
<a href="https://github.com/novlan1/tdesign-uniapp-chat/blob/develop/LICENSE">
<img src="https://img.shields.io/npm/l/tdesign-uniapp-chat.svg?sanitize=true" alt="License">
</a>
<a href="https://www.npmjs.com/package/tdesign-uniapp-chat">
<img src="https://img.shields.io/npm/v/tdesign-uniapp-chat.svg?sanitize=true" alt="Version">
</a>
<a href="https://www.npmjs.com/package/tdesign-uniapp-chat">
<img src="https://img.shields.io/npm/dm/tdesign-uniapp-chat" alt="Downloads">
</a>
<a href="https://pkg.pr.new/~/novlan1/tdesign-uniapp-chat">
<img src="https://pkg.pr.new/badge/novlan1/tdesign-uniapp-chat?style=flat&color=000&logoSize=auto" alt="Downloads">
</a>
<a href="https://deepwiki.com/novlan1/tdesign-uniapp-chat">
<img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki">
</a>
</p>

[TDesign Chat](https://github.com/Tencent/tdesign) 适配 [uniapp](https://uniapp.dcloud.net.cn/) 的组件库。

## 文档

[点此查看](https://uwayfly.com/tdesign-uniapp-chat/)

## 预览

扫码查看 ↓

<img src="https://cdn.uwayfly.com/tdesign-uniapp/tdesign-uniapp-qrcodes.png?a=3" width="600" />

> 其他平台同样支持,仅因平台审核等原因未能上架预览,不影响组件库正常使用。

## 安装

### NPM 方式

```bash
npm i tdesign-uniapp-chat
```

### UNI_MODULES 方式

已上传 [插件](https://ext.dcloud.net.cn/plugin?name=tdesign-uniapp-chat) 到 DCloud 插件市场,请打开插件详情页并点击`使用 HBuilderX 导入插件`。

## 使用

1. 在 `main.ts` 中引入样式文件

```js
import 'tdesign-uniapp/common/style/theme/index.css';
```

也可以引入 `rpx` 单位的 `less` 文件,该文件与 `tdesign-miniprogram` 完全一致。

```js
import 'tdesign-uniapp/common/style/theme/index.less';
```

2. 在文件中使用

```html
<template>
<t-chat-list />
</template>

<script lang="ts" setup>
import TChatList from 'tdesign-uniapp-chat/chat-list/chat-list.vue';
</script>
```

只提供按需导入方式,不支持全量导入(全量导入在小程序下有兼容性问题)。

## 编辑器提示

安装注册 TDesign 之后,在开发项目时,可以配合插件在VSCode等主流编辑器中达到提示组件名及API的效果。

推荐安装 `Volar`,并在项目的 `tsconfig.json` 的 `includes` 属性中增加 `node_modules/tdesign-uniapp-chat/global.d.ts`,即可实现该效果。

## 平台兼容性

| 平台 | Vue2 | Vue3 | H5 | Android | iOS | App-nvue | 微信小程序 | QQ小程序 |
| ------------ | ---- | ---- | --- | ------- | --- | -------- | ---------- | -------- |
| **支持情况** | ✅ | ✅ | ✅ | ✅ | ✅ | ⚠️ | ✅ | ⚠️ |

## 浏览器兼容性

| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari-ios/safari-ios_48x48.png" alt="iOS Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/> iOS Safari| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/samsung-internet/samsung-internet_48x48.png" alt="Samsung" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/>Samsung | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_48x48.png" alt="Opera" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br/>Opera |[<img src="https://user-images.githubusercontent.com/51158141/189169679-71e045f6-9b9b-4baf-8b9f-e045a40216f5.png" alt="Android Browser" width="24px" height="24px" />]()<br/>Android Browser|
| --------- | --------- | --------- | --------- | --------- |--------- |
| Firefox >=104| Chrome >=105| iOS Safari >=12.2| Samsung >=10.2 | Opera >=64 | Android Browser >=105 |

详情参见[移动端组件库浏览器兼容性说明](https://github.com/Tencent/tdesign/wiki/Browser-Compatibility)

## 反馈

有任何问题,建议通过 [Github issues](https://github.com/novlan1/tdesign-uniapp/issues) 反馈或扫码加入用户微信群。

<img src="https://raw.githubusercontent.com/Tencent/tdesign/main/packages/site-components/src/images/groups/wx-group.png" width="200" />

## 开源协议

TDesign 遵循 [MIT 协议](https://github.com/novlan1/tdesign-uniapp/blob/develop/LICENSE)。
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
:: BASE_DOC ::

## API

### Attachments Props

name | type | default | description | required
-- | -- | -- | -- | --
custom-style | Object | - | CSS(Cascading Style Sheets) | N
addable | Boolean | true | \- | N
image-viewer | Boolean | true | \- | N
items | Array | [] | required。Typescript: `FileItem[]` `interface FileItem { fileType: 'image'\|'video'\|'audio'\|'pdf'\|'doc'\|'ppt'\|'txt'; name: string; url: string; size: number; status?: 'success'\|'fail'\|'pending'\|'error'; progress?: number; errorMessage?: string; fileIcon?: string; width?: number; height?: number; mode?: 'aspectFit' \| 'aspectFill' \| 'widthFix' \| 'heightFix' \| 'scaleToFill'}`。[see more ts definition](https://github.com/novlan1/tdesign-uniapp/blob/develop/packages/tdesign-uniapp-chat/attachments/type.ts) | Y
removable | Boolean | true | \- | N

### Attachments Events

name | params | description
-- | -- | --
add | \- | \-
file-click | `(item: FileItem)` | \-
remove | `(item: FileItem, index: number)` | \-
55 changes: 55 additions & 0 deletions packages/tdesign-uniapp-chat/components/attachments/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
title: Attachments 文件附件
description: 用于聊天场景中上传、预览和管理附件的组件。
spline: base
isComponent: true
---


## 引入

可在 `main.ts` 或在需要使用的页面或组件中引入。

```js
import TAttachments from 'tdesign-uniapp-chat/attachments/attachments.vue';
```

### 01 组件类型

#### 图片类型

{{ base }}

#### 文件类型

{{ file }}

### 02 组件状态

#### 图片类型加载状态

{{ image-loading }}

#### 文件类型加载状态

{{ file-loading }}

## API

### Attachments Props

名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
custom-style | Object | - | 自定义样式 | N
addable | Boolean | true | 【讨论中】是否显示添加按钮 | N
image-viewer | Boolean | true | 是否启用图片预览功能 | N
items | Array | [] | 必需。附件列表。TS 类型:`FileItem[]` `interface FileItem { fileType: 'image'\|'video'\|'audio'\|'pdf'\|'doc'\|'ppt'\|'txt'; name: string; url: string; size: number; status?: 'success'\|'fail'\|'pending'\|'error'; progress?: number; errorMessage?: string; fileIcon?: string; width?: number; height?: number; mode?: 'aspectFit' \| 'aspectFill' \| 'widthFix' \| 'heightFix' \| 'scaleToFill'}`。[详细类型定义](https://github.com/novlan1/tdesign-uniapp/blob/develop/packages/tdesign-uniapp-chat/attachments/type.ts) | Y
removable | Boolean | true | 是否显示删除按钮 | N

### Attachments Events

名称 | 参数 | 描述
-- | -- | --
add | \- | 点击添加按钮时触发
file-click | `(item: FileItem)` | 点击文件时触发
remove | `(item: FileItem, index: number)` | 点击删除按钮时触发
Loading
Loading