【问题标题】:Nativescript radiobuttonNativescript 单选按钮
【发布时间】:2017-12-23 12:51:29
【问题描述】:

我正在开发一个 NativeScript 应用程序。我想在我的应用程序中使用单选按钮功能。

我尝试通过使用“nativescript-radiobutton”插件来实现这一点,但它在 iOS 中不支持。

有没有适用于Android和iOS平台的解决方案?

提前谢谢你。

【问题讨论】:

标签: nativescript angular2-nativescript nativescript-plugin


【解决方案1】:

将此 Html 用于单选按钮 -

<Label text="{{ checkYes ? '&#xf192;' : '&#xf10c;'}}" 
       class="{{ checkYes ? 'fontawesome' : 'radioBefore'}}" 
       (tap)="changeAction()">
</Label>

将这两个类应用到 Font Awesome -

.font-awesome {
   font-family: "fontawesome-webfont";
   font-size: 24;
}

.radioBefore {
   font-family: "fontawesome-webfont";
   font-size: 24;
}

在字体文件夹中添加 Font-awesome.ttf 文件,然后将单选按钮 selectedunselected 更改为 changeAction()

功能 - 初始化 this.changeYes = true

 changeGenderMale(){
    if(this.changeYes == true)
      this.changeYes = false;
    else
      this.changeYes = true;
 }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-10-14
    • 1970-01-01
    • 2016-09-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多