Ionic v4 windows platform giving blank screen

2019-07-29 23:34发布

问题:

Does anyone know if ionic 4 has a workable platform for windows?

I've been trying to start a ionic 4 cordova app using the windows platform which works fine with version 3, however gives me a blank screen using version 4 (windows universal platform). It should show me the app in the screen. I think it's something to do with not calling the right js files or something to do with angular 6? I'm pretty new to this, so I apologize if I'm too vague.

steps to recreate -

  1. ionic start myApp tabs --type=angular
  2. open in vs code and navigate to config.xml
  3. add < preference name="windows-target-version" value="10.0" />
  4. navigate to this file using cmd and type ionic cordova platform add windows
  5. then type ionic cordova build windows
  6. this creates a directory called platforms and inside of this called windows.
  7. go into windows and there is a sln file, open with vs studio and press f5 working on local machine.

this gives me a blank screen :( however doing the same steps in ionic version 3 it works fine.

To try and help this situation I changed the index.html file using vs code to change the root from
< script type="text/javascript" src="runtime.js">

to

< script type="text/javascript" src="/www/runtime.js">

I did this to all of the script tag files.

回答1:

I've found a solution! Navigating into the www directory and then going into the index.html that lives inside of there. I change the < base href="/" > to this < base href="./" > and this now allows all of the javascript files to be found and runs on the browser and on windows platform 10. We also checked routing and page loads and everything should be ok. It seems like there is a issue of directories going on.

Update

Don't update anything in the www root as it's dynamically created in the build process. Change the base href in the index.html page instead that doesn't live in the www root directory.



回答2:

yes after i have changed by base href. my apk getting work . but my app css does not work.page design was col