1

我正在開發NativeScript應用程序。我想在我的應用程序中使用單選按鈕功能。Nativescript radiobutton

我試圖通過使用「nativescript-radiobutton」插件來實現這一點,但它不支持在iOS中。

有沒有解決方案可以在Android和iOS平臺上使用?

預先感謝您。

+0

也許你可以使用nativescript-複選框https://www.npmjs.com/package/nativescript-checkbox –

回答

1

使用此HTML單選按鈕 -

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

應用這兩個類的字體真棒 -

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

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

添加字體,awesome.ttf文件中的字體文件夾,然後更改單選按鈕選中未選中changeAction()

功能 - 初始化 this.changeYes = true

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