1 Star 0 Fork 0

aegean317/zz-leaflet-resource

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
index.html 3.10 KB
一键复制 编辑 原始数据 按行查看 历史
aegean317 提交于 2021-03-16 10:53 . 初始化
<!DOCTYPE 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>
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
function loadScript(url, callback) {
var script = document.createElement("script")
script.type = "text/javascript";
if (script.readyState) { //IE
script.onreadystatechange = function () {
if (script.readyState == "loaded" || script.readyState == "complete") {
script.onreadystatechange = null;
callback();
}
};
} else { //Others
script.onload = function () {
callback();
};
}
script.src = url;
document.querySelector("head").appendChild(script);
}
function openFile(url) {
var reader = new FileReader();
reader.onload = function () {
if (reader.result) {
debugger
//显示文件内容
$("#output").html(reader.result);
}
};
reader.readAsText(url);
};
function injectKey(key) {
L.esri.DynamicMapLayer.include({
_requestExport: function (params, bounds) {
if (key) {
params.app_key = key;
}
if (this.options.f === 'json') {
this.service.request(
'export',
params,
function (error, response) {
if (error) {
return;
}
if (this.options.token && response.href) {
response.href += '?token=' + this.options.token;
}
if (this.options.proxy && response.href) {
response.href = this.options.proxy + '?' + response.href;
}
if (response.href) {
this._renderImage(response.href, bounds);
} else {
this._renderImage(response.imageData, bounds, response.contentType);
}
},
this
);
} else {
params.f = 'image';
this._renderImage(this.options.url + 'export' + L.Util.getParamString(params), bounds);
}
}
});
L.TileLayer.addInitHook(function () {
if (key && this.tileUrl.indexOf('app_key') === -1) {
this.tileUrl += '?app_key=' + key;
}
});
}
window.onload = function () {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
console.log(xhr.responseText);
document.write(xhr.responseText)
debugger
}
};
xhr.open(
"get",
"http://192.168.179.71:8000/public/static/zz-leaflet/zz-leaflet.min.js",
true
);
xhr.send();
};
</script>
</head>
<body>
<div class="body"></div>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/luv2/zz-leaflet-resource.git
git@gitee.com:luv2/zz-leaflet-resource.git
luv2
zz-leaflet-resource
zz-leaflet-resource
master

搜索帮助