我正在运行带有电容器3的离子6+。我安装了电容器状态栏和闪屏,如下所示:
npm install @capacitor/status-bar --save
npm install @capacitor/splash-screen --save
npx cap sync
然后像这样导入:
import { SplashScreen } from '@capacitor/splash-screen';
import { StatusBar, Style } from '@capacitor/status-bar';
然后是:
@NgModule({
..........
..........
providers: [ StatusBar,
SplashScreen,
.......
]
vscode会将StatusBar和闪屏标记为以下错误:
Type 'StatusBarPlugin' is not assignable to type 'Provider'.
Type 'SplashScreenPlugin' is not assignable to type 'Provider'.
我也试着切换回使用@ionic-native/splash-screen/ngx'和@ionic-native/status-bar/ngx',即使这样清除了提供程序错误,我还是收到了来自ivy的警告,这些插件需要更新。
谁能解释一下为什么会出现这个错误?
1条答案
按热度按时间5sxhfpxr1#
您不必将插件注册为提供者。只需在您的服务/组件/等中使用它们: