标签组件:(1)指定进入应用程序的默认标签:<ion-tabs id="mainTabs" selectedIndex="0"></ion-tabs>
在页面指定:static get parameters(){
return[[IonicApp]];}
constructor()(APP){
this.app =app;}
onPageDidEnter(){
let tabs = this.app.getComponent(“mainTabs”);
tabs.select(0);}
button组件:<button><ion-button name="home"></ion-button>Login</button>
Input组件:获取输入的用户名,使用角的双向绑定:[(ngModel)] = “user.username”
JS文件中对用户和用户名进行初始化:constructor(){
this.user = {}; //用户是一个对象,所以用{}
this.user.username = “”;}
file(){
alert(this.user.username);}
loading组件:
constructor(
publicloadingCtrl:LoadingController
){
}
test(){
letloader = this.loadingCtrl.create({
content:"请稍等...",
duration:1000
});
loader.present();
的setTimeout(()=> {
loader.dismiss();},3000);
}
Grid组件:
HTML里:<ion-row> <ion-col> </ion-col> </ion-row>
调格式可在SCSS里用:ion-row{padding:0}ion-col {padding:0}
Modal组件:
JS文件中:test(){
var modal = Modal.create(LoginPage);
this.nav.present(modal);
}
toolbar组件:
js文件:
static get parameters(){
return [[ViewController]];
}
constructor(){
this.viewController=viewController;
}
dismiss(){
this.viewController.dismiss();
}
<ion-avatar></ion-avatar>//头像控件
网友评论