- toast组件字体默认居左
import { Component } from '@angular/core';
import { NavController, IonicPage } from 'ionic-angular';
import { AppService } from './../../app/app.service';
import { ToastController } from 'ionic-angular';
@IonicPage()
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(public navCtrl: NavController,public service :AppService,public toast :ToastController) {
}
doClick(){
let toast = this.toast.create({
message: '121',
duration: 200000,
cssClass:'dangers'
});
toast.present();
}
效果图如下:
image.png
通过 dangers
来修改样式;dangers
类要写在app.scss
中:
.dangers{
.toast-message{
display:flex;
justify-content:center;
}
}
image.png
其他样式修改也是如此
网友评论