Skip to content

Commit

Permalink
fix(avatar): 头像aria-label 兜底问题. (Tencent#1028)
Browse files Browse the repository at this point in the history
  • Loading branch information
byq1213 committed Dec 2, 2022
2 parents 3c543a9 + 9d0ec35 commit 7a39b47
Show file tree
Hide file tree
Showing 70 changed files with 848 additions and 402 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ npm start
此时会同时启动 `dist``example` 的构建服务,对应的开发路径与构建路径分别为:

- `src` -> `miniprogram_dist`
- `example` -> `_example`
- `src/*/_exmaple` -> `example` -> `_example`

使用微信开发者工具导入项目 `_example` 文件夹

### 组件开发

-`src` 路径下创建组件文件夹及对应的 `wxml` `ts` `json` `md` 文件
- `example/pages` 路径下创建组件示例页面,路由路径规范未`pages/${组件名}/${组件名}`,例如 `pages/button/button`
- 在文件夹内创建 `_example`路径下创建组件示例页面,路由路径规范为 `src/${组件名}/_example/${组件名}`,例如 `src/button/_example/button`。代码最终会拷贝到 `example/${组件名}/${组件名}` 目录。
- 进行组件开发与示例页开发

### 官方文档开发
Expand Down
7 changes: 4 additions & 3 deletions src/action-sheet/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

name | type | default | description | required
-- | -- | -- | -- | --
align | String | center | `0.29.0`。options:center/left | N
cancel-text | String | - | \- | N
count | Number | 8 | \- | N
custom-style `v0.25.0` | String | - | \- | N
external-classes | Array | - | `['t-class', 't-class-image', 't-class-content']` | N
custom-style | String | - | `0.25.0` | N
description | String | - | `0.29.0` | N
items | Array | - | required。Typescript:`Array<string \| ActionSheetItem>` `interface ActionSheetItem {label: string; color?: string; disabled?: boolean }`[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/action-sheet/type.ts) | Y
show-cancel | Boolean | true | \- | N
theme | String | list | options:list/grid | N
Expand All @@ -19,6 +20,6 @@ default-visible | Boolean | undefined | required。uncontrolled property | Y

name | params | description
-- | -- | --
visible-change | `(visible: Boolean)` | \-
cancel | \- | \-
close | \- | \-
selected | `(selected: ActionSheetItem \| string, index: number)` | \-
11 changes: 6 additions & 5 deletions src/action-sheet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,21 @@ handler.close();

名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
cancel-text | String | 取消 | 设置取消按钮的文本 | N
align | String | center | `0.29.0`。水平对齐方式。可选项:center/left | N
cancel-text | String | - | 设置取消按钮的文本 | N
count | Number | 8 | 设置每页展示菜单的数量,仅当 type=grid 时有效 | N
custom-style `v0.25.0` | String | - | 自定义组件样式 | N
external-classes | Array | - | 组件类名,用于设置组件外层元素类名。。`['t-class', 't-class-image', 't-class-content']` | N
custom-style | String | - | `0.25.0`自定义组件样式 | N
description | String | - | `0.29.0`。动作面板描述文字 | N
items | Array | - | 必需。菜单项。TS 类型:`Array<string \| ActionSheetItem>` `interface ActionSheetItem {label: string; color?: string; disabled?: boolean }`[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/action-sheet/type.ts) | Y
show-cancel | Boolean | true | 是否显示取消按钮 | N
theme | String | list | 展示类型,列表和表格形式展示。可选项:list/grid | N
visible | Boolean | false | 必需。显示与隐藏 | Y
default-visible | Boolean | false | 必需。显示与隐藏。非受控属性 | Y
default-visible | Boolean | undefined | 必需。显示与隐藏。非受控属性 | Y

### ActionSheet Events

名称 | 参数 | 描述
-- | -- | --
visible-change | `(visible: Boolean)` | 当浮层隐藏或显示时触发。
cancel | \- | 点击取消按钮时触发
close | \- | 关闭时触发
selected | `(selected: ActionSheetItem \| string, index: number)` | 选择菜单项时触发
61 changes: 46 additions & 15 deletions src/action-sheet/__test__/__snapshots__/demo.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,69 +1,100 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ActionSheet ActionSheet grid demo works fine 1`] = `
<grid>
exports[`ActionSheet ActionSheet align demo works fine 1`] = `
<align>
<t-action-sheet
id="t-action-sheet"
bind:selected="handleSelected"
/>
<t-button
block="{{true}}"
size="large"
theme="primary"
variant="outline"
bind:tap="handleAction"
>
宫格型
左对齐列表型
</t-button>
</grid>
</align>
`;

exports[`ActionSheet ActionSheet grid-multi demo works fine 1`] = `
<grid-multi>
exports[`ActionSheet ActionSheet grid demo works fine 1`] = `
<grid>
<t-action-sheet
id="t-action-sheet"
bind:selected="handleSelected"
/>
<t-button
block="{{true}}"
size="large"
theme="primary"
variant="outline"
bind:tap="handleAction"
>
宫格型-多页
常规宫格型
</t-button>
<t-button
block="{{true}}"
size="large"
theme="primary"
variant="outline"
bind:tap="handleMultiAction"
>
带翻页宫格型
</t-button>
</grid-multi>
</grid>
`;

exports[`ActionSheet ActionSheet icon-list demo works fine 1`] = `
<icon-list>
exports[`ActionSheet ActionSheet list demo works fine 1`] = `
<list>
<t-action-sheet
id="t-action-sheet"
bind:selected="handleSelected"
/>
<t-button
block="{{true}}"
size="large"
theme="primary"
variant="outline"
bind:tap="handleAction"
>
列表型
</t-button>
<t-button
block="{{true}}"
size="large"
theme="primary"
variant="outline"
bind:tap="showDescAction"
>
带描述列表型
</t-button>
<t-button
block="{{true}}"
size="large"
theme="primary"
variant="outline"
bind:tap="showIconAction"
>
带图标列表型
</t-button>
</icon-list>
</list>
`;

exports[`ActionSheet ActionSheet list demo works fine 1`] = `
<list>
exports[`ActionSheet ActionSheet status demo works fine 1`] = `
<status>
<t-action-sheet
id="t-action-sheet"
bind:selected="handleSelected"
/>
<t-button
block="{{true}}"
size="large"
theme="primary"
variant="outline"
bind:tap="handleAction"
>
列表型
列表型选项状态
</t-button>
</list>
</status>
`;
2 changes: 1 addition & 1 deletion src/action-sheet/__test__/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import simulate from 'miniprogram-simulate';
import path from 'path';

const mapper = ['grid', 'grid-multi', 'icon-list', 'list'];
const mapper = ['align', 'grid', 'list', 'status'];

describe('ActionSheet', () => {
mapper.forEach((demoName) => {
Expand Down
4 changes: 2 additions & 2 deletions src/action-sheet/_example/action-sheet.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"usingComponents": {
"t-toast": "tdesign-miniprogram/toast/toast",
"list": "./list",
"icon-list": "./icon-list",
"status": "./status",
"grid": "./grid",
"grid-multi": "./grid-multi"
"align": "./align"
}
}
1 change: 1 addition & 0 deletions src/action-sheet/_example/action-sheet.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ page {

.wrapper {
margin: 0 32rpx;
display: block;
}
20 changes: 12 additions & 8 deletions src/action-sheet/_example/action-sheet.wxml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<view class="demo">
<view class="demo-title">ActionSheet 动作面板</view>
<view class="demo-desc">底部弹起的模态面板,包含与当前情境相关的多个选项。</view>
<t-demo title="01 类型" />
<view class="wrapper">
<list />
<icon-list />
<grid />
<grid-multi />
</view>
<view class="demo-desc">从底部弹出的模态框,提供和当前场景相关的操作动作,也支持提供信息输入和描述。</view>
<t-demo title="01 组件类型" desc="列表型动作面板" />
<list class="wrapper" />

<t-demo desc="宫格型动作面板" />
<grid class="wrapper" />

<t-demo title="02 组件状态" desc="宫格型动作面板" />
<status class="wrapper" />

<t-demo title="03 组件样式" desc="列表型对齐方式" />
<align class="wrapper" />
</view>
33 changes: 33 additions & 0 deletions src/action-sheet/_example/align/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import ActionSheet, { ActionSheetTheme } from 'tdesign-miniprogram/action-sheet/index';

Component({
methods: {
handleAction() {
ActionSheet.show({
theme: ActionSheetTheme.List,
selector: '#t-action-sheet',
context: this,
align: 'left',
description: '动作面板描述文字',
items: [
{
label: '选项一',
},
{
label: '选项二',
},
{
label: '选项三',
},
{
label: '选项四',
icon: 'app',
},
],
});
},
handleSelected(e) {
console.log(e.detail);
},
},
});
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<t-action-sheet id="t-action-sheet" bind:selected="handleSelected" />

<t-button size="large" variant="outline" bind:tap="handleAction" block>宫格型-多页</t-button>
<t-button size="large" variant="outline" bind:tap="handleAction" block theme="primary">左对齐列表型</t-button>
File renamed without changes.
114 changes: 0 additions & 114 deletions src/action-sheet/_example/grid-multi/index.js

This file was deleted.

Loading

0 comments on commit 7a39b47

Please sign in to comment.