diff --git a/CHANGELOG.md b/CHANGELOG.md index a1e718e7f..5719b1cca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,17 @@ toc: false docClass: timeline --- + ## 🌈 1.2.1 `2023-08-22` +### 🚀 Features +- `Radio`: 新增 `readonly` 属性 @betavs ([#2292](https://github.com/Tencent/tdesign-miniprogram/pull/2292)) +### 🐞 Bug Fixes +- `CellGroup`: 修复 `updateLastChid` 事件被多次触发的问题 @anlyyao ([#2302](https://github.com/Tencent/tdesign-miniprogram/pull/2302)) +- `Popup`: 修复 `visibleChange` 事件参数错误的问题 @anlyyao ([#2303](https://github.com/Tencent/tdesign-miniprogram/pull/2303)) +- `Rate`: 修复value = 0 且半选时图标错误的问题 @betavs ([#2307](https://github.com/Tencent/tdesign-miniprogram/pull/2307)) +- `Radio`: 修复 tap 事件无法冒泡的问题 @LeeJim ([#2309](https://github.com/Tencent/tdesign-miniprogram/pull/2309)) +- `Checkbox`: 修复 tap 事件无法冒泡的问题 @LeeJim ([#2309](https://github.com/Tencent/tdesign-miniprogram/pull/2309)) + + ## 🌈 1.2.0 `2023-08-16` ### 🚀 Features - `Search`: 支持透传更多 Input 的属性 @betavs ([#2229](https://github.com/Tencent/tdesign-miniprogram/pull/2229)) diff --git a/package.json b/package.json index 914c26425..c8fc7ce38 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tdesign-miniprogram", "purename": "tdesign", - "version": "1.2.0", + "version": "1.2.1", "description": "tdesign-miniprogram", "title": "tdesign-ßminiprogram", "main": "miniprogram_dist/index.js", diff --git a/src/cell-group/cell-group.ts b/src/cell-group/cell-group.ts index 57f6a574b..90498984f 100644 --- a/src/cell-group/cell-group.ts +++ b/src/cell-group/cell-group.ts @@ -12,9 +12,6 @@ export default class CellGroup extends SuperComponent { relations: RelationsOptions = { '../cell/cell': { type: 'child', - linked() { - this.updateLastChid(); - }, }, }; @@ -35,6 +32,12 @@ export default class CellGroup extends SuperComponent { classPrefix: name, }; + lifetimes = { + ready() { + this.updateLastChid(); + }, + }; + methods = { updateLastChid() { const items = this.$children; diff --git a/src/checkbox/checkbox.ts b/src/checkbox/checkbox.ts index 462dffba4..b1b69d3c5 100644 --- a/src/checkbox/checkbox.ts +++ b/src/checkbox/checkbox.ts @@ -68,7 +68,7 @@ export default class CheckBox extends SuperComponent { ]; methods = { - onChange(e: WechatMiniprogram.TouchEvent) { + handleTap(e: WechatMiniprogram.TouchEvent) { const { disabled, readonly } = this.data; if (disabled || readonly) return; diff --git a/src/checkbox/checkbox.wxml b/src/checkbox/checkbox.wxml index 08b9582d9..d78ae8016 100644 --- a/src/checkbox/checkbox.wxml +++ b/src/checkbox/checkbox.wxml @@ -6,7 +6,7 @@ aria-role="checkbox" aria-checked="{{checked ? (indeterminate ? 'mixed' : true) : false}}" aria-disabled="{{disabled ? true : false}}" - bind:tap="onChange" + mut-bind:tap="handleTap" tabindex="{{tabindex}}" > - + ` | N keys | Object | - | Typescript:`KeysType` | N diff --git a/src/radio/README.md b/src/radio/README.md index 000532f25..03dbca0db 100644 --- a/src/radio/README.md +++ b/src/radio/README.md @@ -59,6 +59,7 @@ checked | Boolean | false | 是否选中 | N default-checked | Boolean | undefined | 是否选中。非受控属性 | N content | String / Slot | - | 单选内容 | N content-disabled | Boolean | false | 是否禁用组件内容(content)触发选中 | N +readonly | Boolean | false | 只读状态 | N disabled | Boolean | undefined | 是否为禁用态 | N icon | String / Array / Slot | 'circle' | 自定义选中图标和非选中图标。使用 Array 时表示:`[选中态图标,非选中态图标]`。使用 String 时,值为 circle 表示填充型图标、值为 line 表示描边型图标、值为 dot 表示圆点图标,值为 slot 时使用插槽。TS 类型:`'circle' \| 'line' \| 'dot' \| Array` | N label | String / Slot | - | 主文案 | N diff --git a/src/radio/props.ts b/src/radio/props.ts index a51aa2848..cfe79076d 100644 --- a/src/radio/props.ts +++ b/src/radio/props.ts @@ -40,6 +40,11 @@ const props: TdRadioProps = { type: Boolean, value: false, }, + /** 只读状态 */ + readonly: { + type: Boolean, + value: false, + }, /** 是否为禁用态 */ disabled: { type: Boolean, diff --git a/src/radio/radio.ts b/src/radio/radio.ts index 799e23ee4..b97d33693 100644 --- a/src/radio/radio.ts +++ b/src/radio/radio.ts @@ -65,7 +65,7 @@ export default class Radio extends SuperComponent { methods = { handleTap(e) { - if (this.data.disabled) return; + if (this.data.disabled || this.data.readonly) return; const { target } = e.currentTarget.dataset; diff --git a/src/radio/radio.wxml b/src/radio/radio.wxml index bfb59904e..04406b0d2 100644 --- a/src/radio/radio.wxml +++ b/src/radio/radio.wxml @@ -9,7 +9,7 @@ aria-label="{{label + content}}" aria-disabled="{{disabled}}" tabindex="{{tabindex}}" - bind:tap="handleTap" + mut-bind:tap="handleTap" > - + { type: StringConstructor; value?: string; }; + /** + * 只读状态 + * @default false + */ + readonly?: { + type: BooleanConstructor; + value?: boolean; + }; /** * 是否为禁用态 */ diff --git a/src/rate/rate.wxs b/src/rate/rate.wxs index d799da422..8387b108b 100644 --- a/src/rate/rate.wxs +++ b/src/rate/rate.wxs @@ -8,7 +8,7 @@ module.exports = { }, getIconName: function (defaultValue, value, index, icon) { - var curVal = value ? value : defaultValue; + var curVal = value >= 0 ? value : defaultValue; var name = ['star-filled', 'star-filled']; if (icon) { @@ -19,7 +19,7 @@ module.exports = { }, getIconClass: function (classPrefix, defaultValue, value, index, allowHalf, disabled, scaleIndex) { - var curVal = value ? value : defaultValue; + var curVal = value >= 0 ? value : defaultValue; var className = []; if (curVal >= index + 1) { className.push(classPrefix + '--selected'); diff --git a/src/swiper/_example/swiper.wxml b/src/swiper/_example/swiper.wxml index df274944f..22b3d843a 100644 --- a/src/swiper/_example/swiper.wxml +++ b/src/swiper/_example/swiper.wxml @@ -19,7 +19,7 @@ - +