|
本帖最后由 xiays 于 2016-8-15 17:13 编辑
<script type="text/javascript" src="/cordova.js"></script>
<script type="text/javascript">
var deviceready = false;
document.addEventListener('deviceready', function() {
deviceready = true;
}, false);
function scan() {
if (!deviceready) {
alert("扫描失败,cordova尚未初始化完成");
return;
}
cordova.plugins.barcodeScanner.scan(function(result) {
// document.getElementById('url').value = result.text;
window.location.href = result.text;
}, function(error) {
alert("扫描失败:" + error);
});
};
function share(){
if (!deviceready) {
alert("扫描失败,cordova尚未初始化完成");
return;
}
com.justep.cordova.plugin.weixin.v3.share({ message: {
title: "劳伦斯教育APP",
description: "劳伦斯国际美发进修学校",
thumb: "http://192.168.0.92/Public/home/_Resource/img/logo/logo_with_hat.png", //http://YOUR_THUMBNAIL_IMAGE",
media: {
type: com.justep.cordova.plugin.weixin.v3.Type.WEBPAGE, // webpage
webpageUrl: "http://192.168.0.92/d.html" // webpage
}
}}, function () { alert("Success"); },
function (reason) { alert("Failed: " + reason); });
};
</script>
网页是标准WEB,用X5进行打包,打包时已经加入微信.v3插件,由于不是用.w文件开发,所以下面这种方式用不了.require("cordova!com.justep.cordova.plugin.weixin");
var weixin = navigator.weixin;
自己对插件的引用方式也不是太了解.
|
|