diff --git a/packages/components/image/__test__/__snapshots__/demo.test.js.snap b/packages/components/image/__test__/__snapshots__/demo.test.js.snap index 4f7225b177..daa7bb9e26 100644 --- a/packages/components/image/__test__/__snapshots__/demo.test.js.snap +++ b/packages/components/image/__test__/__snapshots__/demo.test.js.snap @@ -17,7 +17,7 @@ exports[`Image Image base demo works fine 1`] = ` ariaLabel="一个放置在墙角的黄色行李箱" height="72" mode="aspectFill" - src="https://tdesign.gtimg.com/mobile/demos/image1.jpeg" + src="https://tdesign.gtimg.com/demo/demo-image-1.png" width="72" /> @@ -33,7 +33,7 @@ exports[`Image Image base demo works fine 1`] = ` ariaLabel="一个放置在墙角的黄色行李箱" height="72" mode="heightFix" - src="https://tdesign.gtimg.com/mobile/demos/image1.jpeg" + src="https://tdesign.gtimg.com/demo/demo-image-1.png" width="72" /> @@ -48,7 +48,7 @@ exports[`Image Image base demo works fine 1`] = ` @@ -68,7 +68,7 @@ exports[`Image Image base demo works fine 1`] = ` ariaLabel="一个放置在墙角的黄色行李箱" height="72" mode="aspectFill" - src="https://tdesign.gtimg.com/mobile/demos/image1.jpeg" + src="https://tdesign.gtimg.com/demo/demo-image-1.png" width="72" /> @@ -84,7 +84,7 @@ exports[`Image Image base demo works fine 1`] = ` ariaLabel="一个放置在墙角的黄色行李箱" height="72" shape="round" - src="https://tdesign.gtimg.com/mobile/demos/image1.jpeg" + src="https://tdesign.gtimg.com/demo/demo-image-1.png" width="72" /> @@ -100,7 +100,7 @@ exports[`Image Image base demo works fine 1`] = ` ariaLabel="一个放置在墙角的黄色行李箱" height="72" shape="circle" - src="https://tdesign.gtimg.com/mobile/demos/image1.jpeg" + src="https://tdesign.gtimg.com/demo/demo-image-1.png" width="72" /> diff --git a/packages/components/image/_example/base/index.js b/packages/components/image/_example/base/index.js index 9f289525c1..646a7b5240 100644 --- a/packages/components/image/_example/base/index.js +++ b/packages/components/image/_example/base/index.js @@ -1,5 +1,5 @@ Component({ data: { - imageSrc: 'https://tdesign.gtimg.com/mobile/demos/image1.jpeg', + imageSrc: 'https://tdesign.gtimg.com/demo/demo-image-1.png', }, }); diff --git a/packages/tdesign-uniapp/.changelog/pr-4536.md b/packages/tdesign-uniapp/.changelog/pr-4536.md new file mode 100644 index 0000000000..6b60e52748 --- /dev/null +++ b/packages/tdesign-uniapp/.changelog/pr-4536.md @@ -0,0 +1,7 @@ +--- +pr_number: 4536 +contributor: novlan1 +--- + +- fix(Form): 修复表单图标在小程序下展示大小问题 @novlan1 ([#4536](https://github.com/Tencent/tdesign-miniprogram/pull/4536)) +- fix(Textarea): 修复 H5 端设置 `autosize` 后,文本内容超过 `maxHeight` 时无法滚动问题 @novlan1 ([#4536](https://github.com/Tencent/tdesign-miniprogram/pull/4536)) diff --git a/packages/tdesign-uniapp/example/src/pages/home/home.vue b/packages/tdesign-uniapp/example/src/pages/home/home.vue index 7f54d77784..15e0eea272 100644 --- a/packages/tdesign-uniapp/example/src/pages/home/home.vue +++ b/packages/tdesign-uniapp/example/src/pages/home/home.vue @@ -4,7 +4,7 @@ - + @@ -31,7 +31,7 @@ 《TDesign组件库服务声明》 - + @@ -80,6 +80,21 @@ export default { debugEnabled: false, }; }, + computed: { + platformDesc() { + let result = '应用'; + + // #ifdef H5 + result = '网站'; + // #endif + + // #ifdef MP + result = '小程序'; + // #endif + + return result; + }, + }, onLoad(options) { const { q, skyline: querySkyline } = options || {}; diff --git a/packages/uniapp-components/count-down/_example/base/index.vue b/packages/uniapp-components/count-down/_example/base/index.vue index f807f56373..5564117926 100644 --- a/packages/uniapp-components/count-down/_example/base/index.vue +++ b/packages/uniapp-components/count-down/_example/base/index.vue @@ -21,6 +21,7 @@ + 带圆形底 @@ -47,6 +48,7 @@ /> + diff --git a/packages/uniapp-components/count-down/_example/count-down.vue b/packages/uniapp-components/count-down/_example/count-down.vue index 26228252ae..0fe8b41b49 100644 --- a/packages/uniapp-components/count-down/_example/count-down.vue +++ b/packages/uniapp-components/count-down/_example/count-down.vue @@ -10,9 +10,11 @@ + + diff --git a/packages/uniapp-components/count-down/count-down.vue b/packages/uniapp-components/count-down/count-down.vue index 24f3e10613..c476f34991 100644 --- a/packages/uniapp-components/count-down/count-down.vue +++ b/packages/uniapp-components/count-down/count-down.vue @@ -55,12 +55,18 @@ export default { prefix, classPrefix: name, timeDataUnit: TimeDataUnit, - timeData: parseTimeData(0), + // 用 Object.freeze 阻断 Vue3 对 timeData 内部 5 个字段的深度响应化, + // 减少鸿蒙 V8 下 Proxy.set 的次数(高频 setTimeout 写 reactive 会触发 GC race -> SIGSEGV) + timeData: Object.freeze(parseTimeData(0)), formattedTime: '0', tools, timeoutId: null, isInitialTime: false, timeRange: [], + // 组件是否已销毁标记(非响应式,仅作为闭包标志使用) + // 用于防止 setTimeout 回调在组件卸载后访问已销毁的 reactive 实例 + // 鸿蒙 (HarmonyOS) 端 V8 在该场景下会触发 SIGSEGV(SEGV_MAPERR) + _destroyed: false, }; }, watch: { @@ -71,8 +77,12 @@ export default { immediate: true, }, }, - mounted() {}, + mounted() { + this._destroyed = false; + }, beforeUnmount() { + this._destroyed = true; + this.counting = false; if (this.timeoutId) { clearTimeout(this.timeoutId); this.timeoutId = null; @@ -92,7 +102,10 @@ export default { pause() { this.counting = false; - this.timeoutId && clearTimeout(this.timeoutId); + if (this.timeoutId) { + clearTimeout(this.timeoutId); + this.timeoutId = null; + } }, reset() { @@ -119,10 +132,14 @@ export default { const { timeText } = parseFormat(remain, format); - const timeRange = format.split(':'); - - this.timeRange = timeRange; - this.timeData = timeData; + // timeRange 仅由 format(prop) 决定,初次或 format 变化时才赋值, + // 避免每帧都写 reactive 数组造成鸿蒙端 V8 GC race。 + if (!this._lastFormat || this._lastFormat !== format) { + this.timeRange = format.split(':'); + this._lastFormat = format; + } + // freeze 一下,禁止 Vue 深度响应化每帧的新对象 + this.timeData = Object.freeze(timeData); this.formattedTime = timeText.replace(/:/g, ' : '); if (remain === 0 && (this.counting || this.isInitialTime)) { @@ -133,7 +150,17 @@ export default { }, doCount() { + // 毫秒模式下从 33ms (≈30fps) 降到 100ms (≈10fps),肉眼仍流畅, + // 但 Proxy.set 频率降低 3 倍,显著降低鸿蒙 V8 GC race 概率。 + let interval = this.millisecond ? 100 : 200; + // #ifdef APP-HARMONY + interval = this.millisecond ? 100 : 500; + // #endif this.timeoutId = setTimeout(() => { + // 组件已销毁,直接返回,避免对已失效的 reactive 实例做 set 操作 + // 修复鸿蒙端因 Vue3 Proxy set 已销毁对象触发 V8 SIGSEGV 崩溃 + if (this._destroyed) return; + const time = this.getTime(); if (this.millisecond) { @@ -142,10 +169,10 @@ export default { this.updateTime(time); } - if (time !== 0) { + if (time !== 0 && !this._destroyed) { this.doCount(); } - }, 33); // 30 帧,因此 1000 / 30 = 33 + }, interval); }, }, }), diff --git a/packages/uniapp-components/demo-navbar/demo-navbar.vue b/packages/uniapp-components/demo-navbar/demo-navbar.vue index b439f12b59..c6fe010869 100644 --- a/packages/uniapp-components/demo-navbar/demo-navbar.vue +++ b/packages/uniapp-components/demo-navbar/demo-navbar.vue @@ -3,7 +3,7 @@ - +