create project

This commit is contained in:
wangjunget
2019-11-08 00:25:24 +08:00
parent 53aec558a2
commit 4f612bc135
5 changed files with 139 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
var exec = require('cordova/exec');
// 对外开放接, 回调函数接收状态栏高度值, 设备独立像素值
exports.getValue = function(success, error) {
// android px to pd
// android 返回px值
// ios 返回pt值
function pxToPd(value) {
var pdr = window.devicePixelRatio;
var pd = value / pdr;
if (cordova.platformId == 'android') {
success(pd)
} else {
success(value)
}
}
exec(pxToPd, error, 'StatusBarHeight', 'getValue', []);
}