1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 基于ion-modal自定义alert弹出框

基于ion-modal自定义alert弹出框

时间:2021-08-22 03:13:09

相关推荐

基于ion-modal自定义alert弹出框

Ionic

1 基于ion-modal自定义alert弹出框

1.1 步骤

1.在全局css样式文件(global.scss)中定义弹出框css样式

.customModal {--background: var(--ion-overlay-background-color,var(--ion-color-step-100, #f9f9f9));--max-width: 270px;--backdrop-opacity: var(--ion-backdrop-opacity, 0.3);--min-width: 250px;--width: auto;--min-height: auto;--height: 50%;--max-height: 100%;}

2.创建组件

ionic g component components/customModal

3.调用方法

async presentModal() {const modal = await this.modalController.create({component: ModalPage,cssClass: 'customModal'});return await modal.present();}

1.2 参考案例

/lixian1998/ionic-custom-alert-modal.git

1.3 效果

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。