Skip to content

Commit 2e9fa26

Browse files
novlan1tdesign-bot
andauthored
首页demo不显示返回按钮 (#4536)
* docs: update tdesign uniapp homepage * chore: 首页demo不显示返回按钮 * chore: update docs home text * perf: 修复鸿蒙下count-down组件的cppcrash问题 * chore: update form demo style * chore: update form demo * chore: update form demo * chore: update harmony dmeo * feat: 使用统一的示例图片地址 * fix(textarea): 修复autosize下无法滑动问题 * chore: stash changelog [ci skip] --------- Co-authored-by: tdesign-bot <tdesign@tencent.com>
1 parent 2a860cf commit 2e9fa26

20 files changed

Lines changed: 146 additions & 36 deletions

File tree

packages/components/image/__test__/__snapshots__/demo.test.js.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ exports[`Image Image base demo works fine 1`] = `
1717
ariaLabel="一个放置在墙角的黄色行李箱"
1818
height="72"
1919
mode="aspectFill"
20-
src="https://tdesign.gtimg.com/mobile/demos/image1.jpeg"
20+
src="https://tdesign.gtimg.com/demo/demo-image-1.png"
2121
width="72"
2222
/>
2323
</wx-view>
@@ -33,7 +33,7 @@ exports[`Image Image base demo works fine 1`] = `
3333
ariaLabel="一个放置在墙角的黄色行李箱"
3434
height="72"
3535
mode="heightFix"
36-
src="https://tdesign.gtimg.com/mobile/demos/image1.jpeg"
36+
src="https://tdesign.gtimg.com/demo/demo-image-1.png"
3737
width="72"
3838
/>
3939
</wx-view>
@@ -48,7 +48,7 @@ exports[`Image Image base demo works fine 1`] = `
4848
<t-image
4949
ariaLabel="一个放置在墙角的黄色行李箱"
5050
height="72"
51-
src="https://tdesign.gtimg.com/mobile/demos/image1.jpeg"
51+
src="https://tdesign.gtimg.com/demo/demo-image-1.png"
5252
width="72"
5353
/>
5454
</wx-view>
@@ -68,7 +68,7 @@ exports[`Image Image base demo works fine 1`] = `
6868
ariaLabel="一个放置在墙角的黄色行李箱"
6969
height="72"
7070
mode="aspectFill"
71-
src="https://tdesign.gtimg.com/mobile/demos/image1.jpeg"
71+
src="https://tdesign.gtimg.com/demo/demo-image-1.png"
7272
width="72"
7373
/>
7474
</wx-view>
@@ -84,7 +84,7 @@ exports[`Image Image base demo works fine 1`] = `
8484
ariaLabel="一个放置在墙角的黄色行李箱"
8585
height="72"
8686
shape="round"
87-
src="https://tdesign.gtimg.com/mobile/demos/image1.jpeg"
87+
src="https://tdesign.gtimg.com/demo/demo-image-1.png"
8888
width="72"
8989
/>
9090
</wx-view>
@@ -100,7 +100,7 @@ exports[`Image Image base demo works fine 1`] = `
100100
ariaLabel="一个放置在墙角的黄色行李箱"
101101
height="72"
102102
shape="circle"
103-
src="https://tdesign.gtimg.com/mobile/demos/image1.jpeg"
103+
src="https://tdesign.gtimg.com/demo/demo-image-1.png"
104104
width="72"
105105
/>
106106
</wx-view>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Component({
22
data: {
3-
imageSrc: 'https://tdesign.gtimg.com/mobile/demos/image1.jpeg',
3+
imageSrc: 'https://tdesign.gtimg.com/demo/demo-image-1.png',
44
},
55
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
pr_number: 4536
3+
contributor: novlan1
4+
---
5+
6+
- fix(Form): 修复表单图标在小程序下展示大小问题 @novlan1 ([#4536](https://github.com/Tencent/tdesign-miniprogram/pull/4536))
7+
- fix(Textarea): 修复 H5 端设置 `autosize` 后,文本内容超过 `maxHeight` 时无法滚动问题 @novlan1 ([#4536](https://github.com/Tencent/tdesign-miniprogram/pull/4536))

packages/tdesign-uniapp/example/src/pages/home/home.vue

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<!-- #endif -->
55
<!-- #ifndef H5 -->
66
<!-- #ifndef MP-ALIPAY -->
7-
<t-demo-navbar title="TDesign UI" />
7+
<t-demo-navbar title="TDesign UI" :left-arrow="false" />
88
<!-- #endif -->
99
<!-- #endif -->
1010
<view class="main">
@@ -31,7 +31,7 @@
3131
</view>
3232
<view class="footer">
3333
<view class="show_privacy" @click="showPrivacyWin"> 《TDesign组件库服务声明》 </view>
34-
<t-footer text="该小程序仅演示示例,不收集个人信息。" />
34+
<t-footer :text="`该${platformDesc}仅演示示例,不收集个人信息。`" />
3535
<t-footer :text="`Copyright © 1998 - ${currentYear} All Rights Reserved`" />
3636
</view>
3737
<trd-privacy ref="trdPrivacy" name="TDesign组件库" date="2023年11月14日" :win-style="winStyle" />
@@ -80,6 +80,21 @@ export default {
8080
debugEnabled: false,
8181
};
8282
},
83+
computed: {
84+
platformDesc() {
85+
let result = '应用';
86+
87+
// #ifdef H5
88+
result = '网站';
89+
// #endif
90+
91+
// #ifdef MP
92+
result = '小程序';
93+
// #endif
94+
95+
return result;
96+
},
97+
},
8398
onLoad(options) {
8499
const { q, skyline: querySkyline } = options || {};
85100

packages/uniapp-components/count-down/_example/base/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
</view>
2222
</view>
2323

24+
<!-- #ifndef APP-HARMONY -->
2425
<view class="demo-count-down">
2526
<text class="demo-count-down-desc"> 带圆形底 </text>
2627
<view class="demo-count-down-content">
@@ -47,6 +48,7 @@
4748
/>
4849
</view>
4950
</view>
51+
<!-- #endif -->
5052
</view>
5153
</template>
5254

packages/uniapp-components/count-down/_example/count-down.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
<base-demo />
1111
</t-demo>
1212

13+
<!-- #ifndef APP-HARMONY -->
1314
<t-demo padding title="02 组件尺寸" desc="倒计时 large/medium/small 尺寸">
1415
<size-demo />
1516
</t-demo>
17+
<!-- #endif -->
1618
</view>
1719
</template>
1820

packages/uniapp-components/count-down/count-down.vue

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,18 @@ export default {
5555
prefix,
5656
classPrefix: name,
5757
timeDataUnit: TimeDataUnit,
58-
timeData: parseTimeData(0),
58+
// 用 Object.freeze 阻断 Vue3 对 timeData 内部 5 个字段的深度响应化,
59+
// 减少鸿蒙 V8 下 Proxy.set 的次数(高频 setTimeout 写 reactive 会触发 GC race -> SIGSEGV)
60+
timeData: Object.freeze(parseTimeData(0)),
5961
formattedTime: '0',
6062
tools,
6163
timeoutId: null,
6264
isInitialTime: false,
6365
timeRange: [],
66+
// 组件是否已销毁标记(非响应式,仅作为闭包标志使用)
67+
// 用于防止 setTimeout 回调在组件卸载后访问已销毁的 reactive 实例
68+
// 鸿蒙 (HarmonyOS) 端 V8 在该场景下会触发 SIGSEGV(SEGV_MAPERR)
69+
_destroyed: false,
6470
};
6571
},
6672
watch: {
@@ -71,8 +77,12 @@ export default {
7177
immediate: true,
7278
},
7379
},
74-
mounted() {},
80+
mounted() {
81+
this._destroyed = false;
82+
},
7583
beforeUnmount() {
84+
this._destroyed = true;
85+
this.counting = false;
7686
if (this.timeoutId) {
7787
clearTimeout(this.timeoutId);
7888
this.timeoutId = null;
@@ -92,7 +102,10 @@ export default {
92102
93103
pause() {
94104
this.counting = false;
95-
this.timeoutId && clearTimeout(this.timeoutId);
105+
if (this.timeoutId) {
106+
clearTimeout(this.timeoutId);
107+
this.timeoutId = null;
108+
}
96109
},
97110
98111
reset() {
@@ -119,10 +132,14 @@ export default {
119132
120133
const { timeText } = parseFormat(remain, format);
121134
122-
const timeRange = format.split(':');
123-
124-
this.timeRange = timeRange;
125-
this.timeData = timeData;
135+
// timeRange 仅由 format(prop) 决定,初次或 format 变化时才赋值,
136+
// 避免每帧都写 reactive 数组造成鸿蒙端 V8 GC race。
137+
if (!this._lastFormat || this._lastFormat !== format) {
138+
this.timeRange = format.split(':');
139+
this._lastFormat = format;
140+
}
141+
// freeze 一下,禁止 Vue 深度响应化每帧的新对象
142+
this.timeData = Object.freeze(timeData);
126143
this.formattedTime = timeText.replace(/:/g, ' : ');
127144
128145
if (remain === 0 && (this.counting || this.isInitialTime)) {
@@ -133,7 +150,17 @@ export default {
133150
},
134151
135152
doCount() {
153+
// 毫秒模式下从 33ms (≈30fps) 降到 100ms (≈10fps),肉眼仍流畅,
154+
// 但 Proxy.set 频率降低 3 倍,显著降低鸿蒙 V8 GC race 概率。
155+
let interval = this.millisecond ? 100 : 200;
156+
// #ifdef APP-HARMONY
157+
interval = this.millisecond ? 100 : 500;
158+
// #endif
136159
this.timeoutId = setTimeout(() => {
160+
// 组件已销毁,直接返回,避免对已失效的 reactive 实例做 set 操作
161+
// 修复鸿蒙端因 Vue3 Proxy set 已销毁对象触发 V8 SIGSEGV 崩溃
162+
if (this._destroyed) return;
163+
137164
const time = this.getTime();
138165
139166
if (this.millisecond) {
@@ -142,10 +169,10 @@ export default {
142169
this.updateTime(time);
143170
}
144171
145-
if (time !== 0) {
172+
if (time !== 0 && !this._destroyed) {
146173
this.doCount();
147174
}
148-
}, 33); // 30 帧,因此 1000 / 30 = 33
175+
}, interval);
149176
},
150177
},
151178
}),

packages/uniapp-components/demo-navbar/demo-navbar.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<t-navbar
44
:class="customClass"
55
:title="title"
6-
left-arrow
6+
:left-arrow="leftArrow"
77
:delta="-1"
88
placeholder
99
:z-index="99"
@@ -31,6 +31,10 @@ export default {
3131
type: String,
3232
default: '',
3333
},
34+
leftArrow: {
35+
type: Boolean,
36+
default: true,
37+
},
3438
},
3539
methods: {
3640
onDemoGoBack() {

packages/uniapp-components/form-item/form-item.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
flex-direction: column;
6262
}
6363

64-
&__icon {
64+
:deep(.@{form-item}__icon) {
6565
font-size: 48rpx;
6666
color: @text-color-placeholder;
6767
}

packages/uniapp-components/form-item/form-item.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
</view>
7373
</view>
7474

75-
<t-icon v-if="arrow" name="chevron-right" :class="formItemClass + '__icon'" />
75+
<t-icon v-if="arrow" name="chevron-right" :t-class="formItemClass + '__icon'" />
7676
</view>
7777
</template>
7878
<script>

0 commit comments

Comments
 (0)