<!DOCTYPE html>声明在IBM MobileFirst中不支持Ionic的ion-nav-view [英] Declaration of <!DOCTYPE html> does not work with Ionic's ion-nav-view in IBM MobileFirst
问题描述
我是使用IBM MobileFirst和Ionic构建混合移动应用程序的初学者。目前,我能够在MobileFirst Console模拟器,模拟器以及Android移动设备中构建和运行我的应用程序。但是,只有当我移除<!DOCTYPE html>
的声明时,所有这些才能正常工作。如果包含<!DOCTYPE html>
,则ion-nav-view不起作用。 基于Ionic的IBM MobileFirst Starter Application示例。在这个例子中,ng-view被用来代替ion-nav-view,因此声明<!DOCTYPE html>
不会导致任何问题。
示例应用程序(Android): https://github.com/user4706148/MobileFirstProject
有人知道这个问题吗?
它看起来像是自动生成的自动插入worklight.css(可以在生成的Android项目> assets \ default_\\\ worklight\worklight.css中找到)触发此问题。
<我猜根据使用的文档类型,其中的CSS规则呈现得不同。具体来说,这是由于以下规则:
body {
position:relative;
}
您不得编辑此文件(因为它会在每个构建中重新生成在MFP Studio中),所以你可以做的就是在你自己的应用程序的自定义.css文件中覆盖它。
这似乎工作正常:
body {
position:none!important;
}
I am a beginner in using IBM MobileFirst with Ionic to build hybrid mobile apps. Currently, I am able to build and run my application in the MobileFirst Console simulator, emulator, as well as in an Android mobile device. However, all these can work well only when I remove the declaration of <!DOCTYPE html>
. If <!DOCTYPE html>
is included, ion-nav-view does not work.
I referred to the Ionic-based IBM MobileFirst Starter Application samples. In the example, ng-view is used instead of ion-nav-view, thus declaration of <!DOCTYPE html>
does not cause any issues.
Sample application (Android): https://github.com/user4706148/MobileFirstProject Does anyone know about this issue?
It looks like it is the auto-generated and auto-inserted worklight.css (can be found in the generated Android project > assets\default\www\worklight\worklight.css) that triggers this issue.
I guess the CSS rules within it get rendered differently according to the used doctype. Specifically, this is happening due to the following rule:
body {
position: relative;
}
You must not edit this file (as it gets re-generated on every build in MFP Studio) so what you can do instead is to override it in your own app's custom .css file.
This seems to work fine:
body {
position: none !important;
}
这篇关于<!DOCTYPE html>声明在IBM MobileFirst中不支持Ionic的ion-nav-view的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!