问题描述
我正在使用iOS/Android上的Framework7制作Cordova应用程序.我正在尝试添加社交共享插件和条形码扫描器插件,但是无法调用该插件函数.但是,当我使用纯HTML和JS(不带Framework7)制作Cordova应用程序时,插件将起作用.为了使这些Cordova插件能够正常工作,我需要在Framework7方面进行任何修改吗?
I am making a Cordova app using Framework7 for iOS/Android. I'm trying to add the social sharing plugin and the barcode scanner plugin but the plugin functions can not be called. However when I made a Cordova app with plain HTML and JS (without Framework7) the plugins would work. Is there anything I have to modify on the Framework7 side to enable these Cordova plugins to work?
推荐答案
cordova.js文件不需要在项目根目录中.每次执行特定的平台构建时,都会在平台构建的项目根目录中自动创建它.
cordova.js file need not be there in your project root directory. Everytime you do a particular platform build, it gets automatically created in the platform build's project root directory.
例如,如果您使用"cordova build android"命令构建android平台,则会在"platforms \ android \ assets \ www"文件夹下生成cordova.js文件.使用任何cordova插件都非常需要此js文件,因为一旦cordova准备就绪且所有插件均已加载,该文件便负责触发"onDeviceReady"事件.您也可以查看一下生成的文件,以获取有关该文件的更多信息.希望对您有所帮助.
For instance, if you build android platform using 'cordova build android' command, the cordova.js file will be generated under 'platforms\android\assets\www' folder. This js file is very much required to use any of the cordova plugins as it is the one which is responsible for triggering 'onDeviceReady' event once the cordova is ready and all plugins are loaded. You can also have a look at the generated file once to get more info on the same. Hope it helps.
这篇关于使用Framework7时Cordova插件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!