【发布时间】:2022-08-18 06:17:31
【问题描述】:
我最近从 Ionic 4 升级到 5,但我的模态样式都不起作用。我已经阅读了文档,并且我正在做的事情似乎应该可行。在global.scss 我有以下内容:
.modal-fullscreen .modal-wrapper {
border-radius: 0;
position: absolute;
top: 20px;
left: 0;
display: block;
width: 100%;
height: 100%;
}
当我创建模态时,我使用modal-fullscreen 作为cssClass 参数。
inviteClient( client : IndexClient ) : void {
this.modalCtrl.create({
component: InviteClientComponent,
componentProps: {
\'consult_client\': client,
\'location_id\': this.location
},
backdropDismiss: false,
cssClass: \"modal-fullscreen\"
}).then( modal => modal.present());
}
文档明确指出这应该在这里工作:
我们建议在 create 方法中将自定义类传递给 cssClass 并使用它为宿主和内部元素添加自定义样式。 此属性还可以接受多个由空格分隔的类。 查看用法部分以获取有关如何使用传递类的示例 css类。
/* DOES NOT WORK - not specific enough */ .modal-wrapper { background: #222; } /* Works - pass \"my-custom-class\" in cssClass to increase specificity */ .my-custom-class .modal-wrapper { background: #222; }知道我能做什么吗?
-
我遇到的问题完全一样,我猜你从来没有找到解决方案
-
我不记得确切但不得不使用这样的东西:
.modal-fullscreen::part(content), ion-modal.modal-fullscreen .modal-wrapper { border-radius: 0; position: absolute; top: 0; left: 0; display: block; width: 100%; height: 100%; }
标签: css ionic-framework