首页 > 代码库 > ionic3自定义单选
ionic3自定义单选
import { Component } from ‘@angular/core‘; import { NavController } from ‘ionic-angular‘; @Component({ selector: ‘page-home‘, templateUrl: ‘home.html‘ }) export class HomePage { list=[{"key":"you","value":‘优‘,"chek":true},{"key":"liang","value":‘良‘,"chek":false},{"key":"cha","value":‘差‘,"chek":false}]; data=http://www.mamicode.com/{"key":"you","value":‘优‘,"chek":true}; constructor(public navCtrl: NavController) { } public chekFun(i){ let me=this; this.list.forEach(function(data,inde,array) { if(i==inde){ data.chek=true; me.data=http://www.mamicode.com/data;>
<ion-header>
<ion-navbar>
<ion-title>
自定义单选
</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<ion-grid text-center>
<ion-row style="font-size: 1.7em;">
<ion-col col-4 *ngFor="let item of list,let i =index" (click)="chekFun(i)">{{item.value}} <ion-icon name="checkmark-circle" [ngClass]="{‘button-clear-ios-primary‘: item.chek,‘button-clear-ios-my‘:!item.chek}"></ion-icon></ion-col>
</ion-row>
</ion-grid>
<button ion-button block (click)="submit()">提交</button>
</ion-content>
ionic3自定义单选
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。