简体   繁体   English

使用@ionic/angular 和@capacitor/XXX 实现插件/Api 之间的区别

[英]Difference between Plugin/Api implementation with @ionic/angular and @capacitor/XXX

I update an app to ionic 5 with capacitor.我使用电容器将应用程序更新为 ionic 5。

Before that, ionic 3 was used with Cordova.在此之前,离子 3 与 Cordova 一起使用。

If I want to display an ActionSheet in the app now, I have two options.如果我现在想在应用程序中显示一个 ActionSheet,我有两个选择。

Either via @ ionic / angular I import the ActionSheetController which is called in the constructor.通过@ ionic / angular 我导入在构造函数中调用的 ActionSheetController 。 https://ionicframework.com/docs/api/action-sheet#methods https://ionicframework.com/docs/api/action-sheet#methods

Or I install and import the Capacitor Action-Sheet Api或者我安装并导入 Capacitor Action-Sheet Api

import {ActionSheet} from '@ capacitor / action-sheet';从'@电容器/动作表'导入{ActionSheet}; https://capacitorjs.com/docs/apis/action-sheet https://capacitorjs.com/docs/apis/action-sheet

Now my question is what, besides the implementation, is the difference between the two.现在我的问题是,除了实现之外,两者之间的区别是什么。 Or is there an argument to use for or against one of them?或者是否有支持或反对其中之一的论据?

That's also available for others Plugins/Apis这也适用于其他插件/Apis

@capacitor/action-sheet uses native action sheets on iOS/Android, while Ionic action-sheet uses a web component that looks like the native action sheet. @capacitor/action-sheet 在 iOS/Android 上使用原生的 action sheet,而 Ionic action-sheet 使用一个看起来像原生 action sheet 的 web 组件。

You can use whatever you like, but remember that Capacitor can be used without Ionic, so not everybody can use Ionic's action-sheet.你可以使用任何你喜欢的东西,但请记住,Capacitor 可以在没有 Ionic 的情况下使用,所以不是每个人都可以使用 Ionic 的操作表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM