【问题标题】:Ionic Button content descriptionIonic Button 内容说明
【发布时间】:2018-02-19 12:19:44
【问题描述】:

我正在为 android/iOS 开发一个 ionic 2 应用程序。在设备中启用对讲功能时,我需要覆盖按钮的内容描述。我尝试在按钮中使用 alt 和 name 选项,但似乎没有任何效果。

<button ion-fab color="danger" (click)="share()" name="share" alt="Share" role="presentation">
  <ion-icon name="md-share" ></ion-icon>
</button>

【问题讨论】:

  • 你得到答案了吗?

标签: ionic-framework ionic2


【解决方案1】:

为了覆盖默认的内容描述,我在按钮中指定了 aria-label,如下所示

<button click)="collapseDetails()" aria-label="Collapse">
  <ion-icon [name]="icon_collapse" aria-hidden="true" item-left color="primary">
  </ion-icon>
  {{ displayName }}          
</button>

为了动态设置 aria-label,您可以使用

<ion-label attr.aria-label="{{display_name}} check the box to receive notifications" >{{display_name}} </ion-label>

【讨论】:

  • 第一个代码块为我工作(使用 Ionic 3)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-02-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-12-14
相关资源
最近更新 更多