ioinc4使模式页面适合内容高度

时间:2020-04-28 01:36:57

标签: ionic-framework

我制作了一个模版页面,就像一个警报。 我想动态设置模式页面高度 但模式高度已固定并可以滚动。

这是我的代码。

global.scss

.custom-modal-alert .modal-wrapper{
    width: 70%;
    min-height: 178px;
    --max-height:1000px;
    height: auto;
    box-shadow: 0 0 2px 0 rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

该问题该怎么办......

enter image description here

1 个答案:

答案 0 :(得分:0)

您可以通过替换模式页面中的<ion-content>标签来实现此目的。

 <div class="modal-container">
     <!-- modal contents go here -->
 </div>

然后将此样式添加到您的全局 sass文件中:

 .custom-modal-alert .modal-wrapper .ion-page {
   position: relative;
   display: contents;
 }

NB。这不适用于页面组件中的ion-content标签。您拥有的其余样式都应该起作用