Skip to content

Commit 18f0979

Browse files
feat(cascader): add current-step
1 parent 0eb83fb commit 18f0979

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/cascader/cascader.wxml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<wxs src="../common/utils.wxs" module="_" />
2+
<wxs src="./cascader.wxs" module="aria" />
23

34
<t-popup class="class" visible="{{visible}}" placement="bottom" bind:visible-change="hide">
45
<view style="{{_._style([style, customStyle])}}" class="{{name}}">
@@ -20,7 +21,8 @@
2021
bind:tap="onStepClick"
2122
data-index="{{index}}"
2223
aria-role="{{ item === defaultOptionLabel ? 'presentation' : 'button' }}"
23-
aria-label="{{ item === defaultOptionLabel ? item : '已选中,' + item }}"
24+
aria-label="{{ item === defaultOptionLabel ? item : aria.getAriaLabel(index, item) }}"
25+
aria-current="{{item === defaultOptionLabel ? '': 'step'}}"
2426
>
2527
<view
2628
class="{{name}}__step-dot {{name}}__step-dot--{{item !== defaultOptionLabel ? 'active' : ''}} {{name}}__step-dot--{{index === steps.length - 1 ? 'last' : ''}}"

src/cascader/cascader.wxs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function getAriaLabel(index, content) {
2+
return '第' + (index + 1) + '级:'+ content;
3+
}
4+
5+
module.exports = {
6+
getAriaLabel: getAriaLabel,
7+
};

0 commit comments

Comments
 (0)