Skip to content

Commit

Permalink
feat(cascader): add current-step
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangpaopao0609 committed Mar 17, 2023
1 parent 0eb83fb commit 18f0979
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/cascader/cascader.wxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<wxs src="../common/utils.wxs" module="_" />
<wxs src="./cascader.wxs" module="aria" />

<t-popup class="class" visible="{{visible}}" placement="bottom" bind:visible-change="hide">
<view style="{{_._style([style, customStyle])}}" class="{{name}}">
Expand All @@ -20,7 +21,8 @@
bind:tap="onStepClick"
data-index="{{index}}"
aria-role="{{ item === defaultOptionLabel ? 'presentation' : 'button' }}"
aria-label="{{ item === defaultOptionLabel ? item : '已选中,' + item }}"
aria-label="{{ item === defaultOptionLabel ? item : aria.getAriaLabel(index, item) }}"
aria-current="{{item === defaultOptionLabel ? '': 'step'}}"
>
<view
class="{{name}}__step-dot {{name}}__step-dot--{{item !== defaultOptionLabel ? 'active' : ''}} {{name}}__step-dot--{{index === steps.length - 1 ? 'last' : ''}}"
Expand Down
7 changes: 7 additions & 0 deletions src/cascader/cascader.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function getAriaLabel(index, content) {
return '第' + (index + 1) + '级:'+ content;
}

module.exports = {
getAriaLabel: getAriaLabel,
};

0 comments on commit 18f0979

Please sign in to comment.