@w6s/cordova-import
Simple CordovaJs import util.
如何使用
当前该js的发布地址为//workplus.io/cordova-import.js
,可在Release页面进行下载。
单页面应用(SPA)引入一次即可,多页面应用需每个页面都逐个引入
简单地在index.html
头部引入即可:
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="//workplus.io/cordova-import.js" type="text/javascript"></script>
<title>Cordova Import Demo</title>
</head>
<body>
<div id="app"></div>
</body>
</html>
可选参数
当前仅支持传入type
类型,可选的值为http
及local
,其中http
为默认的方式,设置方式如下:
<script src="//workplus.io/cordova-import.js?type=local" type="text/javascript"></script>
注意,如果你的页面将可能在iframe里加载,请勿使用local
类型。local
类型适合用于对网络性能要求较高的场合。
配置说明
const config = {
sdkUri: '//workplus.io/cordova-import.js',
...
cordovaImportUri: {
iOS: '//workplus.io/ios.cordova.min.js',
android: '//workplus.io/android.cordova.min.js',
local: 'applocal://cordova.min.js',
},
...
};