Skip to content

Commit

Permalink
1.0.1 (#1703)
Browse files Browse the repository at this point in the history
* fix(SwipeCell): fix docs (#1634)

* fix(Dialog): fix button style (#1633)

* fix(loading): update loading color (#1627)

* Refactor/loading remove (#1626)

* fix(loading): remove bar and error theme

* test(loading): update

* test(image-viewer): update snapshot

* chore(Cell): adjust className for hover-class (#1635)

* chore(Cell): adjust className for hover-class

* test: update snapshots

* chore(Picker&&DateTimePicker): remove footer slot (#1631)

* chore(Radio): align attribute is renamed to placement (#1630)

* chore(Checkbox): align attribute is renamed to placement (#1629)

* chore(Search): remove the right-icon and add the clearable attribute (#1628)

* feat(button): support suffix slot (#1624)

* feat(button): support suffix slot

* test(button): update snapshot

* chore(Avatar): remove bordered attribute (#1632)

* chore(Avatar): remove bordered attribute

* fix: fix cr

* chore(Message): remove action and add the link attribute (#1637)

* chore(Message): remove action and add the link attribute

* fix: fix cr

* fix(navbar): resolve capsule event currectly (#1641)

* chore(Footer): copyright attribute is renamed to text (#1642)

* chore(Footer): copyright attribute is renamed to text

* chore(CountDown): remove theme attribute

* fix(dialog): resolve word misspelling (#1644)

* chore(CountDown): remove hightlight theme (#1645)

* fix(slider): 规范无障碍语义. (#1388)

* fix(slider): 规范无障碍语义

* fix(slider): 无障碍滑块valuetext规范.(#1402)

* fix(slider): 无用动态百分比播报问题.(#1402)

* fix(slider): 隐藏数值读取.(#1402)

* fix(slider): 隐藏数值读取.(#1402)

* fix(slider): 变量规范.(#1402)

* docs(steps): update api

* fix(toast): replace fail theme with error (#1647)

* docs: update api & changelog

* fix: fix overview.md errors (#1651)

* fix: update pages

* fix(collapse): resolve disabled color (#1648)

* fix(collapse): resolve disabled color

* test: update snapshot

* chore(Link): remove status and add disabled and hover (#1652)

* chore(Link): remove status and add disabled and hover

* feat(Link): support external-classes

* feat(Drawer): add hover style (#1673)

* fix(Tag): use catch to bind events (#1669)

* fix(rate): remove variant property and update tips disapper logic (#1674)

* fix(rate): remove variant property and update tips disapper logic

* test(rate): update snapshot

* fix(BackTop): fix icon (#1660)

* fix(Picker): update demo (#1661)

* fix: update sidebar of the site (#1659)

* docs(common): update design docs (#1658)

* fix(SideBar): fix inaccurate positioning when the page was init (#1675)

* fix(slider): remove colors and disabledColor property (#1676)

* feat(AvatarGroup): add border style (#1678)

* fix(dialog): resolve action tsd error and support buttonLayout (#1654) (#1655)

* chore(NoticeBar): extra attribute is renamed to operation (#1638)

* fix(Cell): resolve demo problems (#1679)

* chore: publish v1.0.0 (#1680)

* chore: publish v1.0.0

* chore: changelog's changes

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* docs: update changelog

* chore: update common

* fix(action-sheet): add close event (#1683)

* fix(cascader): resolve events (#1685)

* fix(drawer): resolve close event (#1686)

* feat(picker): add close event (#1687)

* feat(picker): add close event

* test(date-time-picker): update snapshots

* fix(Message): fix t-class-link invalid (#1690)

* fix: fix docs

* fix(Message): fix t-class-link invalid

* fix: fix docs (#1688)

* feat(upload): support aria (#1238)

* feat(upload): support aria

* chore(upload): update snap

* feat(upload): icon hidden

* feat(upload): hack

* revert(upload): revert grid

* chore(upload): update snap

* feat(upload): file.status

* feat(upload): enhance

* feat(upload): upload wxs

* feat(upload): enhance

* feat(upload): add button role

* feat(upload): remove   aria-labelledby="{{labelID}}"

* feat(upload): ariaLabel labelledby

* feat(grid): describedby

* feat(upload): optimization

* fix: resolve radio placement (#1693)

* fix(Message): fix demo for message (#1694)

* chore: publish v1.0.1 (#1695)

* chore: publish v1.0.1

* chore: changelog's changes

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: Y <anly_yaw@163.com>
Co-authored-by: Wang <awangjianjun9@gmail.com>
Co-authored-by: byqbai <byq1213@qq.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: zhangpaopao <zhangpaopao0609@gmail.com>
  • Loading branch information
6 people authored Mar 2, 2023
1 parent 43437d5 commit f3ed075
Show file tree
Hide file tree
Showing 40 changed files with 156 additions and 109 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ spline: explain
toc: false
docClass: timeline
---

## 🌈 1.0.1 `2023-03-01`
### 🚀 Features
- `Cascader`: 新增 close 事件 @LeeJim ([#1685](https://github.com/Tencent/tdesign-miniprogram/pull/1685))
- `Picker`: 新增 close 事件 @LeeJim ([#1687](https://github.com/Tencent/tdesign-miniprogram/pull/1687))
- `DateTimePicker`: 新增 close 事件 @LeeJim ([#1687](https://github.com/Tencent/tdesign-miniprogram/pull/1687))
- `Upload`: 支持无障碍访问 @zhangpaopao0609 ([#1238](https://github.com/Tencent/tdesign-miniprogram/pull/1238))
### 🐞 Bug Fixes
- `ActionSheet`: 补充 close 事件,增加 trigger 参数 @LeeJim ([#1683](https://github.com/Tencent/tdesign-miniprogram/pull/1683))
- `Cascader`: 修复 pick 事件的参数 @LeeJim ([#1685](https://github.com/Tencent/tdesign-miniprogram/pull/1685))
- `drawer`: 修复 close 事件不生效的问题 @LeeJim ([#1686](https://github.com/Tencent/tdesign-miniprogram/pull/1686))
- `Message`: 修复外部样式类 `t-class-link` 无效问题 @anlyyao ([#1690](https://github.com/Tencent/tdesign-miniprogram/pull/1690))
- `Cascader`: 修复 radio 图标显示位置不正确的问题 @LeeJim ([#1693](https://github.com/Tencent/tdesign-miniprogram/pull/1693))
- `DropdownMenu`: 修复 radio 图标显示位置不正确的问题 @LeeJim ([#1693](https://github.com/Tencent/tdesign-miniprogram/pull/1693))
- `TreeSelect`: 修复 radio 图标显示位置不正确的问题 @LeeJim ([#1693](https://github.com/Tencent/tdesign-miniprogram/pull/1693))
- `Message`: 更新内嵌 `link` 组件的属性 @anlyyao ([#1694](https://github.com/Tencent/tdesign-miniprogram/pull/1694))

## 🌈 1.0.0 `2023-02-27`
### ❗ Breaking Changes
- `Cell`: 调整 hover 状态对应的类名 @anlyyao ([#1635](https://github.com/Tencent/tdesign-miniprogram/pull/1635))
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tdesign-miniprogram",
"purename": "tdesign",
"version": "1.0.0",
"version": "1.0.1",
"description": "tdesign-miniprogram",
"title": "tdesign-ßminiprogram",
"main": "miniprogram_dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/action-sheet/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ default-visible | Boolean | undefined | required。uncontrolled property | Y
name | params | description
-- | -- | --
cancel | \- | \-
close | \- | \-
close | `(trigger: TriggerSource)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/action-sheet/type.ts)。<br/>`type TriggerSource = 'overlay' \| 'command' \| 'select' `<br/>
selected | `(selected: ActionSheetItem \| string, index: number)` | \-
2 changes: 1 addition & 1 deletion src/action-sheet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,5 @@ external-classes | Array | - | 组件类名,用于设置组件外层元素类
名称 | 参数 | 描述
-- | -- | --
cancel | \- | 点击取消按钮时触发
close | \- | 关闭时触发
close | `(trigger: TriggerSource)` | 关闭时触发[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/action-sheet/type.ts)。<br/>`type TriggerSource = 'overlay' \| 'command' \| 'select' `<br/>
selected | `(selected: ActionSheetItem \| string, index: number)` | 选择菜单项时触发
3 changes: 3 additions & 0 deletions src/action-sheet/action-sheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@ export default class ActionSheet extends SuperComponent {

/** 指令调用隐藏 */
close() {
this.triggerEvent('close', { trigger: 'command' });
this._trigger('visible-change', { visible: false });
},

/** 默认点击遮罩关闭 */
onPopupVisibleChange({ detail }) {
if (!detail.visible) {
this.triggerEvent('close', { trigger: 'overlay' });
this._trigger('visible-change', { visible: false });
}
if (this.autoClose) {
Expand All @@ -96,6 +98,7 @@ export default class ActionSheet extends SuperComponent {
const realIndex = isSwiperMode ? index + currentSwiperIndex * count : index;
if (item) {
this.triggerEvent('selected', { selected: item, index: realIndex });
this.trigger('close', { trigger: 'select' });
this._trigger('visible-change', { visible: false });
}
},
Expand Down
8 changes: 0 additions & 8 deletions src/action-sheet/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ export interface TdActionSheetProps {
type: NumberConstructor;
value?: number;
};
/**
* 自定义组件样式
* @default ''
*/
style?: {
type: StringConstructor;
value?: string;
};
/**
* 动作面板描述文字
* @default ''
Expand Down
10 changes: 9 additions & 1 deletion src/cascader/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@ close-btn | Boolean / Slot | true | \- | N
keys | Object | - | Typescript:`KeysType` | N
options | Array | [] | Typescript:`Array<CascaderOption>` | N
sub-titles | Array | [] | Typescript:`Array<string>` | N
theme | String | 'step' | options:step/tab | N
theme | String | step | options:step/tab | N
title | String / Slot | - | \- | N
value | String / Number | null | \- | N
default-value | String / Number | undefined | uncontrolled property | N
visible | Boolean | false | \- | N

### Cascader Events

name | params | description
-- | -- | --
change | `(value: string \| number, selectedOptions: string[])` | `1.0.1`
close | `(trigger: TriggerSource)` | `1.0.1`[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/cascader/type.ts)。<br/>`type TriggerSource = 'overlay' \| 'close-btn' \| 'finish'`<br/>
pick | `(value: string \| number, index: number)` | `1.0.1`
10 changes: 9 additions & 1 deletion src/cascader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,16 @@ close-btn | Boolean / Slot | true | 关闭按钮 | N
keys | Object | - | 用来定义 value / label 在 `options` 中对应的字段别名。TS 类型:`KeysType` | N
options | Array | [] | 可选项数据源。TS 类型:`Array<CascaderOption>` | N
sub-titles | Array | [] | 每级展示的次标题。TS 类型:`Array<string>` | N
theme | String | 'step' | 展示风格。可选项:step/tab | N
theme | String | step | 展示风格。可选项:step/tab | N
title | String / Slot | - | 标题 | N
value | String / Number | null | 选项值 | N
default-value | String / Number | undefined | 选项值。非受控属性 | N
visible | Boolean | false | 是否展示 | N

### Cascader Events

名称 | 参数 | 描述
-- | -- | --
change | `(value: string \| number, selectedOptions: string[])` | `1.0.1`。值发生变更时触发
close | `(trigger: TriggerSource)` | `1.0.1`。关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/cascader/type.ts)。<br/>`type TriggerSource = 'overlay' \| 'close-btn' \| 'finish'`<br/>
pick | `(value: string \| number, index: number)` | `1.0.1`。选择后触发
13 changes: 10 additions & 3 deletions src/cascader/cascader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,15 @@ export default class Cascader extends SuperComponent {
});
}
},
hide() {
hide(trigger) {
this.setData({ visible: false });
this.triggerEvent('close', { trigger: trigger });
},
onVisibleChange() {
this.hide('overlay');
},
onClose() {
this.hide('close-btn');
},
onStepClick(e) {
const { index } = e.currentTarget.dataset;
Expand All @@ -152,7 +159,7 @@ export default class Cascader extends SuperComponent {
selectedIndexes[level] = index;
selectedIndexes.length = level + 1;

this.triggerEvent('pick', item[keys?.value ?? 'value'], index);
this.triggerEvent('pick', { value: item[keys?.value ?? 'value'], index });

if (item?.[keys?.children ?? 'children']?.length) {
this.setData({ selectedIndexes });
Expand All @@ -165,7 +172,7 @@ export default class Cascader extends SuperComponent {
selectedOptions: items.map((item, index) => item[selectedIndexes[index]]),
});
});
this.hide();
this.hide('finish');
}
},
};
Expand Down
6 changes: 3 additions & 3 deletions src/cascader/cascader.wxml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<wxs src="../common/utils.wxs" module="_" />

<t-popup class="class" visible="{{visible}}" placement="bottom" bind:visible-change="hide">
<t-popup class="class" visible="{{visible}}" placement="bottom" bind:visible-change="onVisibleChange">
<view style="{{_._style([style, customStyle])}}" class="{{name}}">
<view class="{{name}}__title">
<slot name="title" />
{{title}}
</view>
<view class="{{name}}__close-btn" bind:tap="hide">
<view class="{{name}}__close-btn" bind:tap="onClose">
<slot name="close-btn" />
<t-icon wx:if="{{closeBtn}}" size="24" name="close" />
</view>
Expand Down Expand Up @@ -51,7 +51,7 @@
options="{{options}}"
bind:change="handleSelect"
data-level="{{index}}"
align="right"
placement="right"
icon="line"
borderless
>
Expand Down
10 changes: 1 addition & 9 deletions src/cascader/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ export interface TdCascaderProps<CascaderOption extends TreeOptionData = TreeOpt
type: ObjectConstructor;
value?: KeysType;
};
/**
* 自定义组件样式
* @default ''
*/
style?: {
type: StringConstructor;
value?: string;
};
/**
* 可选项数据源
* @default []
Expand All @@ -48,7 +40,7 @@ export interface TdCascaderProps<CascaderOption extends TreeOptionData = TreeOpt
};
/**
* 展示风格
* @default 'step'
* @default step
*/
theme?: {
type: StringConstructor;
Expand Down
5 changes: 3 additions & 2 deletions src/date-time-picker/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cancel-btn | String | 取消 | \- | N
confirm-btn | String | - | \- | N
end | String / Number | - | \- | N
external-classes | Array | - | `['t-class', 't-class-confirm', 't-class-cancel', 't-class-title']` | N
footer | Slot | true | \- | N
footer | Slot | true | `deprecated` | N
format | String | 'YYYY-MM-DD HH:mm:ss' | \- | N
header | Boolean / Slot | true | \- | N
mode | String / Array | 'date' | Typescript:`DateTimePickerMode` `type DateTimePickerMode = TimeModeValues \| Array<TimeModeValues> ` `type TimeModeValues = 'year' \| 'month' \| 'date' \| 'hour' \| 'minute' \| 'second'`[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts) | N
Expand All @@ -26,5 +26,6 @@ name | params | description
-- | -- | --
cancel | \- | \-
change | `(value: DateValue)` | \-
confirm | `(value: DateValue)` | \-
close | `(trigger: TriggerSource)` | `1.0.1`[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts)。<br/>`type TriggerSource = 'overlay' \| 'cancel-btn' \| 'confrim-btn'`<br/>
confirm | `(value: DateValue)` | `1.0.1`
pick | `(value: DateValue)` | \-
5 changes: 3 additions & 2 deletions src/date-time-picker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ external-classes | Array | - | 组件类名,分别用于设置组件外层元
footer | Slot | true | 已废弃。底部内容 | N
format | String | 'YYYY-MM-DD HH:mm:ss' | 用于pick、change、confirm事件参数格式化[详细文档](https://day.js.org/docs/en/display/format) | N
header | Boolean / Slot | true | 头部内容。值为 true 显示空白头部,值为 false 不显示任何内容,值类型为 TNode 表示自定义头部内容 | N
mode | String / Array | 'date' | year = 年;month = 年月;date = 年月日;hour = 年月日时; minute = 年月日时分;当类型为数组时,第一个值控制年月日,第二个值控制时分秒。TS 类型:`DateTimePickerMode` `type DateTimePickerMode = TimeModeValues \| Array<TimeModeValues> ` `type TimeModeValues = 'year' \| 'month' \| 'date' \| 'hour' \| 'minute' \| 'second'`[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts) | N
mode | String / Array | 'date' | year = 年;month = 年月;date = 年月日;hour = 年月日时; minute = 年月日时分;当类型为数组时,第一个值控制年月日,第二个值控制时分秒,示例:['null', 'second']['date', 'minute']。TS 类型:`DateTimePickerMode` `type DateTimePickerMode = TimeModeValues \| Array<TimeModeValues> ` `type TimeModeValues = 'year' \| 'month' \| 'date' \| 'hour' \| 'minute' \| 'second'`[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts) | N
show-week | Boolean | false | 【开发中】是否在日期旁边显示周几(如周一,周二,周日等) | N
start | String / Number | - | 选择器的最小可选时间,默认为当前时间-10年 | N
title | String | - | 标题 | N
Expand All @@ -64,5 +64,6 @@ visible | Boolean | false | 是否显示 | N
-- | -- | --
cancel | \- | 取消按钮点击时触发
change | `(value: DateValue)` | 确认按钮点击时触发
confirm | `(value: DateValue)` | 【开发中】确认按钮点击时触发
close | `(trigger: TriggerSource)` | `1.0.1`。关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts)。<br/>`type TriggerSource = 'overlay' \| 'cancel-btn' \| 'confrim-btn'`<br/>
confirm | `(value: DateValue)` | `1.0.1`。确认按钮点击时触发
pick | `(value: DateValue)` | 选中值发生变化时触发
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exports[`date-time-picker :base 1`] = `
class="class t-class t-date-time-picker"
bind:cancel="onCancel"
bind:change="onConfirm"
bind:close="onClose"
bind:pick="onColumnChange"
bind:visible-change="onVisibleChange"
>
Expand Down
7 changes: 7 additions & 0 deletions src/date-time-picker/date-time-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ export default class DateTimePicker extends SuperComponent {

const value = format ? date.format(format) : date.valueOf();
this._trigger('change', { value });
this.triggerEvent('confirm', { value });
this.resetColumns();
},

Expand All @@ -374,6 +375,12 @@ export default class DateTimePicker extends SuperComponent {
}
},

onClose(e) {
const { trigger } = e.detail;

this.triggerEvent('close', { trigger });
},

resetColumns() {
const parseDate = this.getParseDate();

Expand Down
1 change: 1 addition & 0 deletions src/date-time-picker/date-time-picker.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
bind:change="onConfirm"
bind:cancel="onCancel"
bind:visible-change="onVisibleChange"
bind:close="onClose"
header="{{header}}"
title="{{title}}"
confirmBtn="{{confirmBtn || locale.confirm}}"
Expand Down
18 changes: 5 additions & 13 deletions src/date-time-picker/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,11 @@ export interface TdDateTimePickerProps {
type: StringConstructor;
value?: string;
};
/**
* 自定义组件样式
* @default ''
*/
style?: {
type: StringConstructor;
value?: string;
};
/**
* 选择器的最大可选时间,默认为当前时间+10年
*/
end?: {
type: StringConstructor;
type: null;
value?: string | number;
};
/**
Expand Down Expand Up @@ -63,7 +55,7 @@ export interface TdDateTimePickerProps {
* @default 'date'
*/
mode?: {
type: StringConstructor;
type: null;
value?: DateTimePickerMode;
};
/**
Expand All @@ -78,7 +70,7 @@ export interface TdDateTimePickerProps {
* 选择器的最小可选时间,默认为当前时间-10年
*/
start?: {
type: StringConstructor;
type: null;
value?: string | number;
};
/**
Expand All @@ -93,14 +85,14 @@ export interface TdDateTimePickerProps {
* 选中值
*/
value?: {
type: StringConstructor;
type: null;
value?: DateValue;
};
/**
* 选中值,非受控属性
*/
defaultValue?: {
type: StringConstructor;
type: null;
value?: DateValue;
};
/**
Expand Down
10 changes: 5 additions & 5 deletions src/drawer/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ name | type | default | description | required
-- | -- | -- | -- | --
close-on-overlay-click | Boolean | undefined | \- | N
destroy-on-close | Boolean | false | \- | N
footer | Slot | - | \- | N
items | Array | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/drawer/type.ts) | N
footer | Slot | - | `0.29.0` | N
items | Array | - | Typescript:`DrawerItem[] ` `interface DrawerItem { title: string; icon: string; }`[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/drawer/type.ts) | N
placement | String | right | options:left/right | N
show-overlay | Boolean | true | \- | N
title | String / Slot | '' | \- | N
title | String / Slot | - | `0.29.0` | N
visible | Boolean | false | \- | N
z-index | Number | - | \- | N
z-index | Number | 11500 | \- | N

### Drawer Events

name | params | description
-- | -- | --
close | `(trigger: DrawerEventSource)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/drawer/type.ts)。<br/>`type DrawerEventSource = 'esc' \| 'close-btn' \| 'cancel' \| 'overlay'`<br/>
close | `(trigger: TriggerSource)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/drawer/type.ts)。<br/>`type TriggerSource = 'overlay'`<br/>
item-click | `(index: number; item: DrawerItem)` | \-
overlay-click | \- | \-
6 changes: 3 additions & 3 deletions src/drawer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ isComponent: true
-- | -- | -- | -- | --
close-on-overlay-click | Boolean | true | 点击蒙层时是否触发抽屉关闭事件 | N
destroy-on-close | Boolean | false | 抽屉关闭时是否销毁节点 | N
footer | Slot | - | `v0.29.0`。抽屉的底部 | N
footer | Slot | - | `0.29.0`。抽屉的底部 | N
items | Array | - | 抽屉里的列表项。TS 类型:`DrawerItem[] ` `interface DrawerItem { title: string; icon: string; }`[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/drawer/type.ts) | N
placement | String | right | 抽屉方向。可选项:left/right | N
show-overlay | Boolean | true | 是否显示遮罩层 | N
title | String / Slot | '' | `v0.29.0`。抽屉的标题 | N
title | String / Slot | - | `0.29.0`。抽屉的标题 | N
visible | Boolean | false | 组件是否可见 | N
z-index | Number | 11500 | 抽屉层级,样式默认为 11500 | N

### Drawer Events

名称 | 参数 | 描述
-- | -- | --
close | `(trigger: DrawerEventSource)` | 关闭事件,取消按钮点击时、关闭按钮点击时、点击蒙层时均会触发[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/drawer/type.ts)。<br/>`type DrawerEventSource = 'esc' \| 'close-btn' \| 'cancel' \| 'overlay'`<br/>
close | `(trigger: TriggerSource)` | 关闭时触发[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/drawer/type.ts)。<br/>`type TriggerSource = 'overlay'`<br/>
item-click | `(index: number; item: DrawerItem)` | 点击抽屉里的列表项
overlay-click | \- | 如果蒙层存在,点击蒙层时触发
7 changes: 6 additions & 1 deletion src/drawer/drawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,21 @@ export default class Drawer extends SuperComponent {
const { showOverlay } = this.data;

this.setData({
visible: visible,
visible,
});

if (!visible) {
this.triggerEvent('close', { trigger: 'overlay' });
}

if (showOverlay) {
this.triggerEvent('overlay-click', { visible: visible });
}
},

itemClick(detail) {
const { index, item } = detail.currentTarget.dataset;

this.triggerEvent('item-click', {
sibarItem: { index: index, item: item },
});
Expand Down
Loading

0 comments on commit f3ed075

Please sign in to comment.