在说明中给出Cordova应用程序时,获得2-3个弹出窗口,然后浏览器卡住了


gap_init:2 
gap:[null,"CoreAndroid","messageChannel","CoreAndroid1594682113"] 
gap:[null,"CoreAndroid","show","CoreAndroid1594682114"]

我试图使用angular js 2.0开发Cordova应用我创建了Cordova Hello World和Angular JS 2.0 Hello World,然后我合并了这两种东西

但是,在运行应用程序时,这些popups是生成的,然后什么也没有发生

您使用Angular-CLI进行项目,然后在Angular-cli.json文件中进行一个Cordova项目 ->将通往Cordova的www文件夹的路径更改。

然后,当您进行ng prod构建时,您的资源将被复制到Cordova的www文件夹中。

我写了一个Cordova钩子,

const fs = require('fs');
const execSync = require('child_process').execSync;

module.exports = function(context) {
    const basePath = context.opts.projectRoot;
    const baseWWW = basePath + '/www';
process.chdir('../bmi-surgical-app');
console.log(`New directory: ${process.cwd()}`);
    execSync("ng build --prod --base-href .",{stdio:[0,1,2]});
    var files = fs.readdirSync(baseWWW);
    for (var i = 0; i < files.length; i++) {
      if (files[i].endsWith('.gz')) {
        fs.unlinkSync(baseWWW + '/' + files[i]);
      }
    }
    fs.writeFileSync(baseWWW + '/.gitignore', `# Ignore everything in this directory
*
# Except this file
!.gitignore
`);

};

但是,有许多更好的选择,例如NativeScript&amp;离子2。

相关内容

最新更新