Skip to content

Commit 0b017d0

Browse files
committed
feat(ui): 添加 TDesign-Uni 组件库支持
1 parent 3bf0618 commit 0b017d0

File tree

9 files changed

+3814
-11820
lines changed

9 files changed

+3814
-11820
lines changed

.github/workflows/core_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
flag-for-ts: ['', --ts]
6262
flag-for-eslint: [-e]
6363
flag-for-plugin: [-p import -p pages -p layouts -p manifest -p filePlatform -p root -p componentPlaceholder -m pinia -m unocss -m uniNetwork -m uniUse -m uniPromises -m uniEcharts -m zPaging]
64-
flag-for-ui: ['', -u uni, -u ano, -u wot, -u nut, -u uv]
64+
flag-for-ui: ['', -u uni, -u ano, -u wot, -u nut, -u uv, -u tdesign]
6565

6666
node: [20.x]
6767
os: [windows-latest, macos-latest]

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ npx @create-uni/info@latest
9999
| :---: | :---: | :---: |
100100
| [uni-ui](https://uniapp.dcloud.net.cn/component/uniui/uni-ui.html) | UniApp 官方组件库 | uni |
101101
| [wot-ui](https://wot-ui.cn/) | 高颜值、轻量化的 uni-app 组件库 | wot |
102+
| [TDesign-Uni](https://tdesign.tencent.com/uni-app/) | Tencent Design 组件库的 uni-app 版本 | tdesign |
102103
| [uView-Pro](https://uviewpro.cn/) | 全面支持 Vue3.0、TypeScript 的 uni-app 生态框架 | uview-pro |
103104
| [nutui-uniapp](https://uniapp-nutui.tech/) | 京东风格的轻量级移动端组件库 | nut |
104105
| [uv-ui](https://www.uvui.cn/components/intro.html) | 多平台快速开发的 UI 框架 | uv |

packages/config/src/ui.data.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,21 @@ export default [
2323
github: 'https://github.com/Moonofweisheng/wot-design-uni',
2424
website: 'https://wot-ui.cn/',
2525
},
26+
{
27+
label: rgb(0, 82, 217)('TDesign Uni'),
28+
hint: 'Tencent Design 组件库的 uni-app 版本',
29+
name: 'TDesign-Uni',
30+
value: 'tdesign',
31+
github: 'https://github.com/Tencent/tdesign-uni',
32+
website: 'https://tdesign.tencent.com/uni-app/',
33+
},
2634
{
2735
label: rgb(41, 121, 255)('uView Pro'),
2836
hint: '全面支持 Vue3.0、TypeScript 的 uni-app 生态框架',
2937
name: 'uView Pro',
3038
value: 'uview-pro',
31-
github: 'https://github.com/anyup/uView-Pro',
32-
website: 'https://uviewpro.cn/',
39+
github: 'https://github.com/Tencent/tdesign-miniprogram',
40+
website: 'https://tdesign.tencent.com/uniapp/',
3341
},
3442
{
3543
label: rgb(250, 44, 25)('Nut Ui'),
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"dependencies": {
3+
"@tdesign/uniapp": "^0.7.1"
4+
}
5+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<script setup lang="ts">
2+
import { ref } from 'vue'
3+
4+
const name = ref('')
5+
const visible = ref(false)
6+
7+
function handleClick() {
8+
visible.value = true
9+
}
10+
</script>
11+
12+
<template>
13+
<view class="input-box">
14+
<input
15+
v-model="name"
16+
placeholder="What's your name?"
17+
>
18+
</view>
19+
<view>
20+
<t-button
21+
block
22+
size="large"
23+
variant="outline"
24+
theme="primary"
25+
:disabled="!name"
26+
@click="handleClick"
27+
>
28+
Hello
29+
</t-button>
30+
</view>
31+
32+
<t-popup
33+
:visible="visible"
34+
placement="bottom"
35+
@update:visible="visible = $event"
36+
>
37+
<view class="block block--bottom">
38+
Hello{{ ` ${name}` }} 👏
39+
</view>
40+
</t-popup>
41+
</template>
42+
43+
<style scoped lang="scss">
44+
.input-box {
45+
margin: 1rem;
46+
padding: 0.5rem;
47+
border-bottom: 1px solid gray;
48+
}
49+
50+
.block {
51+
color: var(--td-text-color-secondary);
52+
display: flex;
53+
align-items: center;
54+
justify-content: center;
55+
width: 100vw;
56+
height: 240px;
57+
}
58+
</style>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
export default function getData({ oldData, utils }) {
2+
const autoImportTDesignUniPlugin = {
3+
id: 'tdesign-uni',
4+
importer: `import { TDesignUniappResolver } from '@uni-helper/vite-plugin-uni-components/resolvers'`,
5+
}
6+
7+
return {
8+
...oldData,
9+
plugins: oldData.plugins.flatMap(plugin =>
10+
plugin.id === 'autoImport'
11+
? [utils.addResolver(plugin, 'TDesignUniappResolver()'), autoImportTDesignUniPlugin]
12+
: plugin,
13+
),
14+
}
15+
}

packages/core/template/config/typescript/jsconfig.json.data.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export default function getData({ oldData }) {
33
id: 'tsConfig',
44
options: `"lib": ["DOM", "DOM.Iterable", "ESNext"],
55
"module": "ESNext",
6-
"moduleResolution": "Bundler",
6+
"moduleResolution": "bundler",
77
"resolveJsonModule": true,
88
"jsx": "preserve",
99
"jsxImportSource": "vue",

packages/mcp/test/promptBuilder.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ it('promptBuilder', () => {
2020
- " ": 不安装
2121
- uni: UniApp官方组件库
2222
- wot: 高颜值、轻量化的uni-app组件库
23+
- tdesign: Tencent Design 组件库的 uni-app 版本
2324
- uview-pro: 全面支持 Vue3.0、TypeScript 的 uni-app 生态框架
2425
- nut: 京东风格的轻量级移动端组件库
2526
- uv: 多平台快速开发的UI框架
@@ -33,6 +34,7 @@ it('getConfigValuesAsEnum', () => {
3334
" ",
3435
"uni",
3536
"wot",
37+
"tdesign",
3638
"uview-pro",
3739
"nut",
3840
"uv",
@@ -47,6 +49,8 @@ it('templatePromptBuilder', () => {
4749
- vitesse: 由Uni Helper维护的快速启动模板
4850
- wot-starter: 由Wot UI提供的基于 vitesse-uni-app 的快速启动模板
4951
- wot-starter-retail: 基于Wot UI的 uni-app 零售行业模板
52+
- uview-pro-starter: 由 uView Pro 提供的基于 vitesse-uni-app 的快速启动模板
53+
- uview-pro-demo: 由 uView Pro 提供的完整组件演示模板
5054
- unisave: 拥抱 web 开发,拯救uniapp。适配所有 (app、mp、web) 平台
5155
- tmui32: 优质 Vue3 TS Pinia Vite 跨端组件库模板"
5256
`)
@@ -58,6 +62,8 @@ it('getTemplateValuesAsEnum', () => {
5862
"vitesse",
5963
"wot-starter",
6064
"wot-starter-retail",
65+
"uview-pro-starter",
66+
"uview-pro-demo",
6167
"unisave",
6268
"tmui32",
6369
]

0 commit comments

Comments
 (0)