72 lines
1.6 KiB
HTML
72 lines
1.6 KiB
HTML
<html>
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<!--重要meta, 必须!-->
|
|
<meta name="viewport"
|
|
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0,shrink-to-fit=no" />
|
|
<title>SUBWAY</title>
|
|
<style>
|
|
html,
|
|
body {
|
|
margin: 0;
|
|
padding: 0;
|
|
height: 100%;
|
|
width: 100%;
|
|
overflow: hidden;
|
|
}
|
|
|
|
#mysubway {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
#cityList {
|
|
position: absolute;
|
|
top: 10px;
|
|
left: 10px;
|
|
z-index: 999;
|
|
background: rgba(255, 255, 255, 0.8);
|
|
padding: 5px;
|
|
border-radius: 5px;
|
|
border: 1px solid #ccc;
|
|
max-width: 200px;
|
|
max-height: 600px;
|
|
overflow: auto;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="mysubway"></div>
|
|
<div id="cityList">123</div>
|
|
|
|
<script src="https://webapi.amap.com/subway?v=1.0&key=1894fdb3350f516c62fc6c2844fb8116&callback=cbk"></script>
|
|
<script type="module">
|
|
import { showCity } from './show-city.js';
|
|
//开启easy模式, 直接完成地铁图基本功能, 无需自己写交互
|
|
window.cbk = function () {
|
|
var mySubway = subway("mysubway", {
|
|
// easy: 1
|
|
adcode: 1100,
|
|
theme: "colorful",
|
|
client: 0,
|
|
doubleclick: {
|
|
switch: true
|
|
}
|
|
});
|
|
mySubway.event.on('subway.complete', function () {
|
|
|
|
mySubway.showLine('6号线');
|
|
console.log(mySubway);
|
|
// var allLineList = mySubway.getCityList((v)=>{
|
|
// console.log(v);
|
|
// });
|
|
// console.log(allLineList);
|
|
})
|
|
};
|
|
showCity();
|
|
</script>
|
|
</body>
|
|
|
|
</html> |