File tree Expand file tree Collapse file tree 12 files changed +41
-16
lines changed
Expand file tree Collapse file tree 12 files changed +41
-16
lines changed Original file line number Diff line number Diff line change 66
77import { TdRadioGroupProps } from './type' ;
88const props : TdRadioGroupProps = {
9+ /** 是否允许取消选中 */
10+ allowUncheck : {
11+ type : Boolean ,
12+ value : false ,
13+ } ,
914 /** 是否开启无边框模式 */
1015 borderless : {
1116 type : Boolean ,
Original file line number Diff line number Diff line change 77 class="{{prefix}}-radio-option"
88 data-index="{{index}}"
99 data-value="{{item.value}}"
10- data-allow-uncheck="{{item.allowUncheck || false }}"
10+ data-allow-uncheck="{{item.allowUncheck || allowUncheck }}"
1111 block="{{item.block || true}}"
1212 label="{{item.label || ''}}"
1313 value="{{item.value}}"
1414 checked="{{item.checked || false}}"
1515 content="{{item.content || ''}}"
16- allow-uncheck="{{item.allowUncheck || false }}"
16+ allow-uncheck="{{item.allowUncheck || allowUncheck }}"
1717 content-disabled="{{item.contentDisabled || false}}"
1818 readonly="{{item.readonly || false}}"
1919 disabled="{{item.disabled || false}}"
Original file line number Diff line number Diff line change 77import { KeysType } from '../common/common' ;
88
99export interface TdRadioGroupProps < T = RadioValue > {
10+ /**
11+ * 是否允许取消选中
12+ * @default false
13+ */
14+ allowUncheck ?: {
15+ type : BooleanConstructor ;
16+ value ?: boolean ;
17+ } ;
1018 /**
1119 * 是否开启无边框模式
1220 * @default false
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ value | String / Number / Boolean | false | Typescript:`T` `type RadioValue =
2929name | params | description
3030-- | -- | --
3131change | ` (checked: boolean) ` | \-
32+
3233### Radio External Classes
3334
3435className | Description
@@ -46,6 +47,7 @@ name | type | default | description | required
4647-- | -- | -- | -- | --
4748style | Object | - | CSS(Cascading Style Sheets) | N
4849custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
50+ allow-uncheck | Boolean | false | \- | N
4951borderless | Boolean | false | \- | N
5052disabled | Boolean | undefined | \- | N
5153icon | String / Array | 'circle' | Typescript:` 'circle' \| 'line' \| 'dot' \| Array<string> ` | N
Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ value | String / Number / Boolean | false | 单选按钮的值。TS 类型:`T`
8282名称 | 参数 | 描述
8383-- | -- | --
8484change | ` (checked: boolean) ` | 值变化时触发
85+
8586### Radio External Classes
8687
8788类名 | 描述
@@ -99,6 +100,7 @@ t-class-label | 标签样式类
99100-- | -- | -- | -- | --
100101style | Object | - | 样式 | N
101102custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
103+ allow-uncheck | Boolean | false | 是否允许取消选中 | N
102104borderless | Boolean | false | 是否开启无边框模式 | N
103105disabled | Boolean | undefined | 是否禁用全部子单选框 | N
104106icon | String / Array | 'circle' | 自定义选中图标和非选中图标。示例:[ 选中态图标,非选中态图标] 。使用 String 时,值为 circle 表示填充型图标、值为 line 表示描边型图标、值为 dot 表示圆点图标;仅在使用 options 时生效。TS 类型:` 'circle' \| 'line' \| 'dot' \| Array<string> ` | N
Original file line number Diff line number Diff line change 33exports [` Radio Radio align demo works fine 1` ] = `
44<align >
55 <t-radio
6+ allowUncheck = " {{true}}"
67 defaultChecked = " {{true}}"
78 label = " 单选"
89 value = " radio1"
@@ -11,6 +12,7 @@ exports[`Radio Radio align demo works fine 1`] = `
1112 class = " block"
1213 />
1314 <t-radio
15+ allowUncheck = " {{true}}"
1416 defaultChecked = " {{true}}"
1517 label = " 单选"
1618 placement = " right"
@@ -22,6 +24,7 @@ exports[`Radio Radio align demo works fine 1`] = `
2224exports [` Radio Radio base demo works fine 1` ] = `
2325<base >
2426 <t-radio-group
27+ allowUncheck = " {{true}}"
2528 options = " {{
2629 Array [
2730 Object {
@@ -101,6 +104,7 @@ exports[`Radio Radio horizontal demo works fine 1`] = `
101104exports [` Radio Radio special demo works fine 1` ] = `
102105<special >
103106 <t-radio-group
107+ allowUncheck = " {{true}}"
104108 value = " {{0}}"
105109 bind:change="onChange"
106110 >
@@ -212,6 +216,7 @@ exports[`Radio Radio status demo works fine 1`] = `
212216exports [` Radio Radio theme demo works fine 1` ] = `
213217<theme >
214218 <t-radio
219+ allowUncheck = " {{true}}"
215220 defaultChecked = " {{true}}"
216221 icon = " line"
217222 label = " 单选"
@@ -221,6 +226,7 @@ exports[`Radio Radio theme demo works fine 1`] = `
221226 style = " height: 32rpx"
222227 />
223228 <t-radio
229+ allowUncheck = " {{true}}"
224230 defaultChecked = " {{true}}"
225231 icon = " dot"
226232 label = " 单选"
Original file line number Diff line number Diff line change 1- <t-radio value="radio1" label="单选" default-checked />
1+ <t-radio value="radio1" allow-uncheck label="单选" default-checked />
22
33<view class="block"></view>
44
5- <t-radio value="radio2" label="单选" placement="right" default-checked />
5+ <t-radio value="radio2" allow-uncheck label="单选" placement="right" default-checked />
Original file line number Diff line number Diff line change 1- <t-radio-group bind:change="onChange" value="{{current}}" options="{{options}}" />
1+ <t-radio-group bind:change="onChange" allow-uncheck value="{{current}}" options="{{options}}" />
Original file line number Diff line number Diff line change 1- <t-radio-group value="{{value}}" bind:change="onChange">
1+ <t-radio-group value="{{value}}" allow-uncheck bind:change="onChange">
22 <view wx:for="{{3}}" wx:key="index" class="card {{value == index ? 'card--active' : ''}}">
33 <t-icon wx:if="{{value == index}}" name="check" t-class="card__icon" />
44 <t-radio value="{{index}}" label="单选" content="描述信息描述信息描述信息描述信息描述信息" icon="none" borderless />
Original file line number Diff line number Diff line change 1- <t-radio default-checked="{{true}}" icon="line" label="单选" />
1+ <t-radio default-checked="{{true}}" allow-uncheck icon="line" label="单选" />
22
33<view class="gutter" style="height: 32rpx"></view>
44
5- <t-radio default-checked="{{true}}" icon="dot" label="单选" />
5+ <t-radio default-checked="{{true}}" allow-uncheck icon="dot" label="单选" />
You can’t perform that action at this time.
0 commit comments