我已经创建了Ionic 4电容应用程序。它在默认情况下显示了这一点,并且没有Cordova插件。
package.json
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",app.component.ts
async initializeApp(): Promise<void> {
await this.platform.ready();
this.statusBar.styleDefault();
this.splashScreen.hide();
}但是电容医生说它在与它不兼容的位置。我是否需要删除这个本地插件并使用电容实现,或者因为这里没有Cordova,这不会有任何问题吗?
发布于 2020-02-13 14:36:36
我们正在更新初学者应用程序模板--很快,它们将默认为电容API。
我认为这两个人实际上与Cap一起工作,但正如Ricardo所写的,我们的建议是使用Capacitor。
这是我在我们的示例应用程序中使用的
import { Component } from '@angular/core';
import { Plugins } from '@capacitor/core';
const { SplashScreen } = Plugins;
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['app.component.scss']
})
export class AppComponent {
constructor() {
this.initializeApp();
}
initializeApp() {
/* To make sure we provide the fastest app loading experience
for our users, hide the splash screen automatically
when the app is ready to be used:
https://capacitor.ionicframework.com/docs/apis/splash-screen#hiding-the-splash-screen
*/
SplashScreen.hide();
}
}发布于 2020-02-13 13:49:03
电容状态是不兼容的科多瓦插件,因为它提供自己的cordova-(不需要,电容有自己的),因此我建议你应该使用一个从电容器。
与此类似的是:
const { SplashScreen, StatusBar } = Plugins;
try {
await SplashScreen.hide();
await StatusBar.setStyle({ style: StatusBarStyle.Light });
} catch (err) {
console.log('This does not have influence on the browser', err);
}发布于 2020-08-04 14:57:10
在四处寻找之后,我找不到解决办法。
但是在玩了Xcode之后,我发现了一种可能是暂时的解决方案。
您必须使用Xcode....this中的本机代码更改状态栏颜色,这是我可以提供的唯一解决方案。
https://stackoverflow.com/questions/60207429
复制相似问题