Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -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"
/>
</wx-view>
Expand All @@ -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"
/>
</wx-view>
Expand All @@ -48,7 +48,7 @@ exports[`Image Image base demo works fine 1`] = `
<t-image
ariaLabel="一个放置在墙角的黄色行李箱"
height="72"
src="https://tdesign.gtimg.com/mobile/demos/image1.jpeg"
src="https://tdesign.gtimg.com/demo/demo-image-1.png"
width="72"
/>
</wx-view>
Expand All @@ -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"
/>
</wx-view>
Expand All @@ -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"
/>
</wx-view>
Expand All @@ -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"
/>
</wx-view>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/image/_example/base/index.js
Original file line number Diff line number Diff line change
@@ -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',
},
});
7 changes: 7 additions & 0 deletions packages/tdesign-uniapp/.changelog/pr-4536.md
Original file line number Diff line number Diff line change
@@ -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))
19 changes: 17 additions & 2 deletions packages/tdesign-uniapp/example/src/pages/home/home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<!-- #endif -->
<!-- #ifndef H5 -->
<!-- #ifndef MP-ALIPAY -->
<t-demo-navbar title="TDesign UI" />
<t-demo-navbar title="TDesign UI" :left-arrow="false" />
Comment thread
novlan1 marked this conversation as resolved.
<!-- #endif -->
<!-- #endif -->
<view class="main">
Expand All @@ -31,7 +31,7 @@
</view>
<view class="footer">
<view class="show_privacy" @click="showPrivacyWin"> 《TDesign组件库服务声明》 </view>
<t-footer text="该小程序仅演示示例,不收集个人信息。" />
<t-footer :text="`该${platformDesc}仅演示示例,不收集个人信息。`" />
<t-footer :text="`Copyright © 1998 - ${currentYear} All Rights Reserved`" />
</view>
<trd-privacy ref="trdPrivacy" name="TDesign组件库" date="2023年11月14日" :win-style="winStyle" />
Expand Down Expand Up @@ -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 || {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
</view>
</view>

<!-- #ifndef APP-HARMONY -->
<view class="demo-count-down">
<text class="demo-count-down-desc"> 带圆形底 </text>
<view class="demo-count-down-content">
Expand All @@ -47,6 +48,7 @@
/>
</view>
</view>
<!-- #endif -->
</view>
</template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
<base-demo />
</t-demo>

<!-- #ifndef APP-HARMONY -->
<t-demo padding title="02 组件尺寸" desc="倒计时 large/medium/small 尺寸">
<size-demo />
</t-demo>
<!-- #endif -->
</view>
</template>

Expand Down
45 changes: 36 additions & 9 deletions packages/uniapp-components/count-down/count-down.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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;
Expand All @@ -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() {
Expand All @@ -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)) {
Expand All @@ -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) {
Expand All @@ -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);
},
},
}),
Expand Down
6 changes: 5 additions & 1 deletion packages/uniapp-components/demo-navbar/demo-navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<t-navbar
:class="customClass"
:title="title"
left-arrow
:left-arrow="leftArrow"
:delta="-1"
placeholder
:z-index="99"
Expand Down Expand Up @@ -31,6 +31,10 @@ export default {
type: String,
default: '',
},
leftArrow: {
type: Boolean,
default: true,
},
},
methods: {
onDemoGoBack() {
Expand Down
2 changes: 1 addition & 1 deletion packages/uniapp-components/form-item/form-item.less
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
flex-direction: column;
}

&__icon {
:deep(.@{form-item}__icon) {
font-size: 48rpx;
color: @text-color-placeholder;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/uniapp-components/form-item/form-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
</view>
</view>

<t-icon v-if="arrow" name="chevron-right" :class="formItemClass + '__icon'" />
<t-icon v-if="arrow" name="chevron-right" :t-class="formItemClass + '__icon'" />
</view>
</template>
<script>
Expand Down
33 changes: 28 additions & 5 deletions packages/uniapp-components/form/_example/horizontal/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
show-error-message
scroll-to-first-error="smooth"
label-align="left"
:label-width="85"
content-align="right"
@reset="(e) => onReset(e, { tagId: 'form' })"
@submit="(e) => onSubmit(e, { tagId: 'form' })"
Expand Down Expand Up @@ -54,20 +55,31 @@
</t-radio-group>
</t-form-item>

<t-form-item label="生日" name="birth" content-align="right">
<t-form-item arrow label="生日" name="birth" content-align="right">
<t-input
:value="formData.birth"
:disabled="disabled"
borderless
align="right"
placeholder="请输入生日"
placeholder="请选择生日"
:readonly="!isH5"
data-field="birth"
style="flex: 1"
@change="(e) => onInputChange(e, { field: 'birth' })"
@click="showDatePicker"
/>
<t-date-time-picker
:visible="visibleDatePicker"
auto-close
title="选择生日"
mode="date"
:default-value="formData.birth"
format="YYYY-MM-DD"
@update:visible="(e) => (visibleDatePicker = e)"
@change="onChangeDatePicker"
/>
</t-form-item>

<t-form-item arrow label="籍贯" name="place" content-align="right">
<t-form-item arrow label="籍贯" name="place" content-align="left">
<t-input
ref="input"
:value="formData.place"
Expand Down Expand Up @@ -168,6 +180,7 @@
import TButton from '@tdesign/uniapp/button/button.vue';
import TCascader from '@tdesign/uniapp/cascader/cascader.vue';
import { canUseVirtualHost } from '@tdesign/uniapp/common/version';
import TDateTimePicker from '@tdesign/uniapp/date-time-picker/date-time-picker.vue';
import TForm from '@tdesign/uniapp/form/form.vue';
import TFormItem from '@tdesign/uniapp/form-item/form-item.vue';
import TInput from '@tdesign/uniapp/input/input.vue';
Expand All @@ -191,6 +204,7 @@ export default {
TRadio,
// TPopup,
TCascader,
TDateTimePicker,
TStepper,
TRate,
TTextarea,
Expand All @@ -209,7 +223,7 @@ export default {
name: '',
password: '',
gender: '',
birth: '',
birth: '2020-01-01',
place: '',
age: 3,
description: 2,
Expand All @@ -228,6 +242,7 @@ export default {
],
},
visibleCascader: false,
visibleDatePicker: false,
address: '120119',
rateGap: 8,
action: 'https://service-bv448zsw-1257786608.gz.apigw.tencentcs.com/api/upload-demo',
Expand Down Expand Up @@ -451,6 +466,14 @@ export default {
onChangeStepper(e) {
this.formData.age = e.value;
},
showDatePicker() {
this.visibleDatePicker = true;
uni.hideKeyboard();
},
onChangeDatePicker(e) {
this.formData.birth = e.value;
this.visibleDatePicker = false;
},
onFail(e) {
console.log('[onFail]: ', e);
},
Expand Down
Loading
Loading