Ionic framework 页面刷新时,Ionic CSS未加载
在我的ionic应用程序中,当应用程序第一次打开时,一切看起来都很完美。但是如果我刷新页面,css就不会加载,页面看起来很糟糕。这只在iPhone的Chrome外观上明显可见。问题一直存在,直到我使用ionic serve命令重新启动应用程序。但如果我打开一个新的匿名标签,一切似乎都正常 有什么问题 这是第一次看: 这是第二次看: 这是我的scss代码:Ionic framework 页面刷新时,Ionic CSS未加载,ionic-framework,sass,styles,Ionic Framework,Sass,Styles,在我的ionic应用程序中,当应用程序第一次打开时,一切看起来都很完美。但是如果我刷新页面,css就不会加载,页面看起来很糟糕。这只在iPhone的Chrome外观上明显可见。问题一直存在,直到我使用ionic serve命令重新启动应用程序。但如果我打开一个新的匿名标签,一切似乎都正常 有什么问题 这是第一次看: 这是第二次看: 这是我的scss代码: page-home { .ion-header {font-family:Georgia, 'Times New Roman', Time
page-home {
.ion-header {font-family:Georgia, 'Times New Roman', Times, serif; color:#BBBF95; font-size: 18px !important;font-weight: bold !important;}
.ion-content-preview {color:white !important;font-style: italic;}
.item-content {
background-color: var(--main-bg-color);
}
.item-md {
background: transparent !important;
}
ion-toolbar {
min-height: 20px !important;
height: 20px !important;
}
.page-count{
float:right !important;
margin-right: 14px !important;
color:white !important;
min-height: 10px !important;
height: 10px !important;
margin-top: 3px !important;
}
.item-checkbox {
padding-left: 8px;
padding-top: 3px;
}
.item-checkbox .checkbox {
right: auto;
color:white !important;
font-family: "Roboto", "Helvetica Neue", sans-serif !important;
}
ion-select{
float:right !important;
margin-top: -30px !important;
}
}
感谢您的帮助。最初加载“应用程序”时,浏览器启动时,您的开发人员工具未处于活动状态。爱奥尼亚根据您的设备选择“主题”。如果你检查你的页面,你会发现在启动时会得到带有“platformcore”类的“md”(还有更多的东西)。在启用设备模式的情况下使用开发者工具时,如果此时刷新,应用程序将重新加载,并根据您的“所选设备”再次设置类。在你的情况下,iphone6/7/8。现在,您将拥有例如“ios”和“平台ios”以及更多设置。这是给你的“css错误” 顺便说一句,这不是一个错误。您只需要实现一些特定于平台的css调整。那会解决你的问题 尝试使用:
ionic serve --lab
您将能够查看多个平台及其样式。这样,您将能够轻松地检查它们,并更轻松地创建特定于平台的css调整
设备模式:
我用你的想法解决了这个问题。我添加了.item ios{background:transparent;},一切都很好。谢谢你的帮助。